BME | Stat - Overview
T-test
Evaluating the means of one or two populations.
- 
One sample t-test: evaluate whether a single group differs from a known value R: t.test | MATLAB: ttest | Python: ttest_1samp 1 
 2
 3
 4t.test(x, m, 
 alternative = c("two.sided", "less", "greater"),
 var.equal = FALSE)
 # m is mean that you want to test1 
 2[h,p] = ttest(x,m, 'Tail','right/left/both') 
 % m is mean that you want to test1 
 2
 3
 4
 5from scipy import stats 
 stats.ttest_1samp(rvs, popmean=3,
 alternative={‘two-sided’, ‘less’, ‘greater’},
 nan_policy={‘propagate’, ‘omit’, ‘raise’})
 # popmean is mean that you want to test
- 
Independent two sample t-test: evaluate whether two groups differ from each other R: t.test | MATLAB: ttest2 | Python: ttest_ind 1 
 2
 3t.test(x, y, 
 alternative = c("two.sided", "less", "greater"),
 paired = FALSE, var.equal = FALSE)1 h = ttest2(x,y, 'Tail','right/left/both') 1 
 2
 3
 4from scipy import stats 
 stats.ttest_ind(rvs1, rvs2, equal_var=False,
 alternative={‘two-sided’, ‘less’, ‘greater’},
 nan_policy={‘propagate’, ‘omit’, ‘raise’})
- 
Paired sample t-test: evaluate whether there is a significant difference in paired measurements R: t.test | MATLAB: ttest | Python: ttest_rel 1 
 2
 3t.test(x, y, 
 alternative = c("two.sided", "less", "greater"),
 paired = FALSE)1 [h,p] = ttest(x,y, 'Tail','right/left/both') 1 
 2
 3
 4from scipy import stats 
 stats.ttest_rel(rvs1, rvs3,
 alternative={‘two-sided’, ‘less’, ‘greater’},
 nan_policy={‘propagate’, ‘omit’, ‘raise’})
ANOVA
- 
One-way ANOVA To investigate whether different levels of a control variable have a significant effect on the observed variable. 1 1 1 
- 
Two-way ANOVA 
- 
Repeated Measures ANOVA 
Normality Test
Type: Shapiro–Wilk test | One-sample Kolmogorov-Smirnov test
Aim: To assess whether samples came from a normally distributed population.
R: shapiro.test | MATLAB: kstest | Python: normaltest
| 1 | res_aov <- aov(flipper_length_mm ~ species, data = dat) | 
| 1 | [h,p] = kstest(x) | 
| 1 | from scipy import stats | 
Equal Variance (Levene’s Test)
To assess the equality of variances for a variable calculated for two or more groups.
R: leveneTest | MATLAB: vartestn | Python: levene
| 1 | # Levene's test | 
| 1 | load examgrades | 
| 1 | from scipy import stats | 
Chi-sq test
Fisher test
Wilcoxon test
- 
Wilcoxon signed-rank test 
- 
Wilcoxon Rank Sum test 
