Cheatsheet module 3
Cheatsheet module 3: hypothesis testing
Decision rules
- H1 first, H0 is the opposite with an equals sign. You reject H0 or retain H0; you never prove H0.
- p-value <= alpha (or test statistic in the rejection region): reject H0.
- p-value = probability of an outcome at least as extreme if H0 is true; not the probability that H0 is true.
- one-sided p = half of the two-sided p, if the direction is right. Choose direction and alpha before the data.
- Interval contains the H0 value: not significant.
- Type I error = rejecting H0 while true (alpha). Type II error = retaining H0 while false (beta). Power = 1 - beta. Lower alpha: Type II up; only a larger n lowers both.
Formulas (formula sheet)
- t = (x-bar - mu0) / (s / sqrt(n)), df = n - 1
- z (proportion) = (p-hat - p0) / sqrt(p0 (1 - p0) / n)
- CI = estimate +/- critical value x SE
- chi-square = sum (O - E)^2 / E; E = row total x column total / total; df = (r - 1)(c - 1)
- Cronbach’s alpha: formula sheet. F formula and decision rules are not.
- Flipping: (max + min) - score; 1 to 5: 6 - score
Which test?
- Mean against a value: one-sample t. Two groups: two-sample t. Same people twice: paired t.
- Three or more groups: ANOVA, then Tukey. Proportion: z-test. Two categorical variables: chi-square.
Reading R output
- Paired: t = -32.543, df = 692 (pairs minus 1), difference -53.51, interval -56.74 to -50.28: reject H0.
- Welch: p = 0.08939, interval -7.38 to 0.53 contains 0: retain H0.
- One-sample: t = 3.7721, df = 182, p = 0.0002188 two-sided, 0.0001094 one-sided.
- aov: F = 49.31 (df 2 and 690), p < 2e-16: at least two groups differ. Tukey 2-1: 9.03, p adj = 0.0002.
- Two-way: interaction p = 0.0355; read it first.
- chi-square goodness of fit: X-squared = 0.18182, df 2, p = 0.9131. Independence: p = 0.89.
- prop.test: p = 0.3868.
Likert and Cronbach’s alpha
- Item = ordinal; scale = items combined (composite score). Flip reverse coded items first.
- Risk scale: alpha -0.0984 raw, 0.7978 after flipping. Negative = almost always a coding error. Above 0.7 acceptable; it measures consistency, not validity.
Pitfalls
- Not significant is not “no effect”. Significant is not important.
- Two-sample t on paired data; separate t-tests for three groups.
- Naming a group after ANOVA without Tukey; ignoring the interaction.
- Chi-square on percentages or means.