forked from erikaduan/r_tips
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
301 additions
and
224 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
134 changes: 78 additions & 56 deletions
134
03_blog_posts/2020-05-16_untangling-strings/2020-05-16_untangling-strings.Rmd
Large diffs are not rendered by default.
Oops, something went wrong.
228 changes: 82 additions & 146 deletions
228
03_blog_posts/2020-05-16_untangling-strings/2020-05-16_untangling-strings.md
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file modified
BIN
-32 Bytes
(100%)
...g-strings/2020-05-16_untangling-strings_files/figure-gfm/unnamed-chunk-21-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+874 Bytes
(110%)
...bution/2020-09-12_binomial-distribution_files/figure-gfm/unnamed-chunk-13-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions
60
...05_statistical-testing-for-proportions/2020-11-05_statistical-testing-for-proportions.Rmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
title: "Untitled" | ||
author: "Erika Duan" | ||
date: "21/10/2020" | ||
output: html_document | ||
--- | ||
|
||
If you are using categorical data you can use the Kruskal-Wallis test (the non-parametric equivalent of the one-way ANOVA) to determine group differences. If the test shows there are differences between the 3 groups. You can use the Mann-Whitney test to do pairwise comparisons as a post hoc or follow up analysis. Since you're only doing a few comparisons (i.e. X vs. Y, X, vs Z, and Y vs. Z) you wouldn't have to worry about family wise error rates. | ||
|
||
With SPSS, you can run a chi-square, and test for pair-wise differences between the pair of groups. Put your 3 groups in columns, and "ride the tube: yes/no in the rows. Use the raw numbers in the 6 cells. Select the option to use Bonferroni corrections for the pairwise comparisons. Using sub-scripted (super-scripted?) letters, SPSS will tell you which of the pairwise differences are significant, while preserving the overall (experiment-wise) 0.05 significance level. | ||
|
||
Chi-square test | ||
|
||
Compare three or more unmatched groups One-way ANOVA Kruskal-Wallis test Chi-square test | ||
|
||
https://www.graphpad.com/support/faqid/1790/ | ||
|
||
The chi-square test on the counts actually does check for homogeneity of proportions. | ||
|
||
http://www.sthda.com/english/wiki/two-proportions-z-test-in-r | ||
|
||
https://stats.stackexchange.com/questions/70107/fishers-exact-test-in-r-2x4-table | ||
|
||
https://data.library.virginia.edu/pairwise-comparisons-of-proportions/ | ||
|
||
https://uc-r.github.io/multivariate_inference | ||
|
||
https://stats.libretexts.org/Bookshelves/Introductory_Statistics/Book%3A_Introductory_Statistics_(Shafer_and_Zhang)/09%3A_Two-Sample_Problems/9.04%3A_Comparison_of_Two_Population_Proportions | ||
|
||
|
||
|
||
https://uc-r.github.io/multivariate_inference | ||
|
||
|
||
```{r} | ||
# packages used regularly | ||
library(tidyverse) | ||
# full population data | ||
# A tibble: 4 x 4 | ||
## # Groups: Attrition [2] | ||
## Attrition Gender n pct | ||
## <fctr> <fctr> <int> <dbl> | ||
## 1 No Female 501 0.406 | ||
## 2 No Male 732 0.594 | ||
## 3 Yes Female 87 0.367 | ||
## 4 Yes Male 150 0.633 | ||
attrition_by_gender = tibble(Attrition = c("No", "No", "Yes", "Yes"), | ||
Gender = c("Female", "Male", "Female", "Male"), | ||
n = c(501, 732, 87, 150), | ||
proportion = c(0.406, 0.594, 0.367, 0.633)) | ||
``` | ||
|
||
|
||
```{r} | ||
``` | ||
|
||
|
45 changes: 45 additions & 0 deletions
45
03_blog_posts/2020-12-30_regression-analysis/2020-12-30_regression-analysis.Rmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: "Introduction to regression analysis" | ||
author: "Erika Duan" | ||
date: "`r Sys.Date()`" | ||
output: | ||
github_document: | ||
toc: true | ||
pandoc_args: --webtex | ||
--- | ||
|
||
```{r, echo = TRUE, message = FALSE, warning = FALSE} | ||
#-----load required packages----- | ||
if (!require("pacman")) install.packages("pacman") | ||
pacman::p_load(here, | ||
tidyverse, | ||
tidymodels, | ||
glmnet, | ||
patchwork) | ||
``` | ||
|
||
|
||
# Introduction | ||
|
||
|
||
# Linear Regression | ||
|
||
```{r} | ||
#-----perform single variable linear regression----- | ||
orange <- as_tibble(Orange) | ||
lm_fit <- lm(age ~ circumference, data = orange) | ||
summary(lm_fit) | ||
``` | ||
|
||
```{r} | ||
#-----tidy results of linear regression----- | ||
tidy(lm_fit) | ||
glance(lm_fit) | ||
``` | ||
|
||
|
||
# Resources | ||
|
||
+ https://www.tidymodels.org/learn/statistics/tidy-analysis/ |