Hypothesis testing
Hypothesis testing: p values, errors, statistical tests, correlation and regression
Hypothesis tests ask whether an observed difference could reasonably be due to chance. The choice of test depends on data type, number of groups, pairing and distribution, and correlation and regression describe relationships between variables. Survival analysis handles time-to-event data.
Hypothesis testing
- Null hypothesis (H₀): no difference/association. Alternative (H₁): there is one.
- p value: probability of obtaining the observed result (or more extreme) if H₀ were true. p < 0.05: reject H₀ ("statistically significant"). It is not the probability that H₀ is true, and says nothing about clinical importance.
- Statistical significance ≠ clinical significance (large studies detect trivial differences).
- One-tailed versus two-tailed tests (two-tailed is standard).
- Multiple comparisons increase type I error, so use Bonferroni correction (α/number of tests).
Errors
| H₀ true | H₀ false | |
|---|---|---|
| Reject H₀ | Type I error (α) — false positive | Correct (power, 1 − β) |
| Do not reject H₀ | Correct | Type II error (β) — false negative |
- Type I: concluding a drug works when it does not. Type II: missing a real effect (small samples).
Choosing a statistical test
| Data / comparison | Parametric (normal, continuous) | Non-parametric (skewed, ordinal, small samples) |
|---|---|---|
| Two independent groups | Unpaired (independent) t-test | Mann–Whitney U (Wilcoxon rank-sum) |
| Two paired/related measurements (before–after, matched) | Paired t-test | Wilcoxon signed-rank |
| Three or more independent groups | One-way ANOVA (F test; post hoc tests) | Kruskal–Wallis |
| Three or more related measurements | Repeated measures ANOVA | Friedman test |
| Correlation between two variables | Pearson's r | Spearman's rank (ρ), Kendall's tau |
| One sample mean versus known value | One-sample t-test (z-test if large sample/known SD) | Sign test |
| Categorical data | Test |
|---|---|
| Two or more independent proportions (contingency table) | Chi-squared (χ²) test |
| Small expected frequencies (< 5 in > 20% of cells) | Fisher's exact test |
| Paired categorical data (before–after on same subjects) | McNemar's test |
| Trend across ordered groups | Chi-squared for trend |
| Stratified 2 × 2 tables (confounding) | Mantel–Haenszel |
- Parametric tests compare means; non-parametric tests use ranks (compare medians/distributions); parametric tests are more powerful when assumptions hold.
Correlation
- Pearson's correlation coefficient (r): strength and direction of linear relationship between two continuous normally distributed variables; −1 to +1; 0 = no linear relationship.
- r = +1 perfect positive; −1 perfect negative; |r| > 0.7 strong.
- r² (coefficient of determination): proportion of variance in one variable explained by the other (r = 0.8 gives 64%).
- Correlation does not imply causation; sensitive to outliers; may miss non-linear relationships.
- Spearman's ρ: ranks; non-normal or ordinal data, monotonic relationships.
Regression
- Simple linear regression: predicts outcome (dependent, y) from one predictor (independent, x): y = a + bx (a = intercept, b = slope/regression coefficient — change in y per unit change in x).
- Multiple (multivariable) linear regression: several predictors; adjusts for confounders.
- Logistic regression: binary outcome (disease yes/no) gives adjusted odds ratios.
- Cox proportional hazards regression: time-to-event outcome gives hazard ratios.
- Poisson regression: count outcomes/rates.
Survival analysis
- Kaplan–Meier method: survival curve accounting for censored data (lost to follow-up, alive at study end); step function.
- Log-rank test: compares survival curves between groups.
- Median survival: time at which 50% have died.
- Hazard ratio from Cox regression.
Other
- Bland–Altman plot: agreement between two measurement methods (not correlation).
- Kappa: agreement for categorical ratings (see validity and reliability).
- Analysis of covariance (ANCOVA).
How FCPS asks it
Recalls test: meaning of p value; type I and II errors; matching scenario to test (paired t-test for before–after BP; unpaired t-test for two group means; ANOVA for three groups; chi-squared for proportions; Fisher's for small numbers; McNemar for paired proportions; Mann–Whitney for skewed data; Wilcoxon signed-rank for paired skewed data; Kruskal–Wallis); Pearson versus Spearman; r²; regression types by outcome; Kaplan–Meier and log-rank; censoring.
Exam trap Comparing means of two independent groups: unpaired t-test; same subjects before and after: paired t-test.
Exam trap Chi-squared compares proportions; use Fisher's exact when expected counts are small.
Exam trap Logistic regression is used for a binary outcome and gives adjusted odds ratios.
Test yourself on this topic
5 of the 13 questions in our bank on this topic. Choose an answer to see why every option is right or wrong.
For two independent normally distributed samples with similar variances, which listed test conventionally tests a difference in population means?
Answer: Student's t test
The independent-samples Student t test compares two means under these assumptions. One-way ANOVA with two groups and a binary-predictor linear regression can give equivalent tests; they are not restricted to three or more groups.
Tests of significance
- t test: two means
- ANOVA: three or more means
- Chi-square: proportions
- Paired t: before and after
Remember t test compares two means; ANOVA for more than two.
Why the other options are wrong
- Fisher's exact test Fisher's exact test compares proportions in small 2 x 2 tables.
- Logistic regression Models a categorical outcome rather than testing the mean of the continuous outcome specified.
- Chi-square test Chi-square compares proportions or frequencies in categorical data.
- Kruskal-Wallis test A rank-based test of distributional differences, rather than the specified parametric comparison of means.
In a trial, the mean fall in systolic blood pressure is 4 mmHg greater with drug B than with drug A, and the report gives p = 0.03. How should this result be interpreted?
Answer: Significant at the 5% level but not at the 1% level
A p value is the probability of getting a difference this large by chance if there were truly no difference (the null hypothesis). By convention, p below 0.05 (a 1 in 20 chance) is taken as significant, and p below 0.01 (1 in 100) as more strongly significant. With p = 0.03 the null hypothesis is rejected at the 5% level but not at the 1% level. It is not the probability that the drug works.
P value
- p = chance of the result if there is no real difference
- Significant when p < 0.05
- More significant when p < 0.01
- p is not the probability the drug works
Remember p = 0.03: significant at 5%, not at 1%.
Why the other options are wrong
- Significant at both the 5% and the 1% levels Significance at the 1% level needs p below 0.01.
- Not significant, so the null hypothesis is retained p is below 0.05, so the null hypothesis is rejected at the 5% level.
- There is a 97% probability that drug B is better A common misreading: p is not the probability that a treatment is effective.
- There is a 3% chance that the result is a false negative A false negative is a type II error; p relates to a false-positive conclusion.
In hypothesis testing, an alpha level of 0.001 represents the maximum accepted probability of:
Answer: Type I error
Alpha is the pre-set probability of rejecting a true null hypothesis, which is a type I error. An alpha of 0.001 therefore accepts a 0.1% chance of a false positive finding.
Alpha and type I error
- Alpha = type I error probability
- Beta = type II error probability
- Power = 1 minus beta
- Smaller alpha means a stricter test
Remember Alpha is the probability of a type I error.
Why the other options are wrong
- Confidence interval An interval estimate rather than the type I error probability.
- Selection bias A systematic sampling problem rather than the prespecified false-positive probability.
- Type II error Failure to reject a false null, whose probability is beta.
- Power of the test Probability of rejecting a false null, equal to 1 minus beta.
What value of the correlation coefficient indicates a perfect positive correlation?
Answer: +1
The correlation coefficient r ranges from -1 to +1. A value of +1 means all points lie on a straight upward line, so one variable rises exactly as the other rises.
Correlation coefficient
- r ranges -1 to +1
- +1 all points on rising line
- -1 all points on falling line
- 0 means no linear relation
Remember Perfect positive correlation has r equal to +1; perfect negative is -1; none is 0.
Why the other options are wrong
- -0.5 Moderate negative correlation.
- 0 No linear relationship.
- +0.5 Moderate positive correlation, not perfect.
- -1 Perfect negative correlation, all points on a downward line.
A student wants to assess the relationship between rise in body temperature and duration of surgery, both measured as continuous values. Which test is appropriate?
Answer: Pearson correlation
Two continuous variables whose association is being assessed need a correlation coefficient, here Pearson's r. Tests that compare means or proportions between groups answer a different question.
Choice of test
- Two continuous variables → correlation
- Groups' means → t-test or ANOVA
- Categories → chi-square
- r ranges from −1 to +1
Remember Association between two continuous variables is tested by correlation (Pearson's r).
Why the other options are wrong
- One-way ANOVA Compares means across three or more groups.
- Fisher exact test Used for small-sample categorical data in 2x2 tables.
- Chi-square test Compares proportions of categorical variables, not two continuous measurements.
- Independent t-test Compares the means of two independent groups, not a relationship between two variables.
Where this sits in the CPSP syllabus
- Paper 1: Biostatistics, Hypothesis testing: p values, errors, statistical tests, correlation and regression