| Y | X | Statistical Analysis | R function |
|---|---|---|---|
| Quantitative Variable |
None | Mean test (one sample) |
t.test() |
| None | Variance test (one sample) |
qchisq() | |
| 1 categorical variable 2 categories |
Mean test (two samples) |
t.test() | |
| 1 categorical variable 2 categories |
Variance test (two samples) |
var.test() ansari.test() mood.test() |
|
| 1 categorical variable 2 categories |
ANOVA (one-way) | aov() with_summary() |
|
| 1 categorical variable >= 2 categories |
Variance test (multiple samples) |
Bartlett.test() fligner.test() |
|
| >=2 categorical variable >= 2 categories |
ANOVA (two-way or multi-way) |
aov() & summary() | |
| 1 quantitative variable | Correlation Test | cor.test() | |
| 1 quantitative variable | Regression | lm() & summary() | |
| >= 2 quantitative variables | Multivariate linear model | lm() & summary() glm() & summary() |
|
| Quantitative and categorical variables | GEE, mixed model, etc. | Contributed packages | |
| 2 categories (0,1) | None | Proportion test (one sample) |
binom.test() |
| 2 categories (0,1) | 1 categorical variable >= 2 categories |
Proportion test (multiple samples) |
prop.test() |
| >= 2 categories | >= 1 categorical variable(s) >= 2 categories |
Proportion test (multiple samples) |
chisq.test() fisher.test() |
| >= 2 categories | >= 1 categorical variable(s) >= 2 categories |
Independence and interaction test (ANOVA of frequency data) | glm(family=poisson) with summary() |
| >= 2 categories | >= 1 quantitative/categorical variables |
Logistic regression | glm() with summary() |