Tests of Significance, Power and Sample Size, Regression and Correlation, and Matrix Inversion
2. The z, t, chi-square and F tests
Which test applies is decided by what is known and what is being compared. With the population standard deviation σ known (or n large, say above 30), the z-test for a mean uses z = (x̄ − μ₀)/(σ/√n). With σ estimated from the sample by s, the statistic t = (x̄ − μ₀)/(s/√n) follows Student’s t distribution with n − 1 degrees of freedom, which has heavier tails than the normal and approaches it as n grows: the two-tailed 5% critical value is 2.776 at 4 degrees of freedom, 2.262 at 9 and 2.228 at 10, falling towards 1.96.
| Question | Statistic | Degrees of freedom |
|---|---|---|
| One mean, σ known | z = (x̄ − μ₀)/(σ/√n) | — (normal) |
| One mean, σ unknown | t = (x̄ − μ₀)/(s/√n) | n − 1 |
| Same subjects before and after (paired) | t = d̄/(s_d/√n) on the differences | n − 1 (n pairs) |
| Two independent groups, equal variances | t = (x̄₁ − x̄₂)/[s_p√(1/n₁ + 1/n₂)] | n₁ + n₂ − 2 |
| Observed counts against expected (fit, or independence in an r × c table) | χ² = Σ(O − E)²/E | k − 1 for fit; (r − 1)(c − 1) for a table |
| Two variances | F = s₁²/s₂² (larger on top) | n₁ − 1, n₂ − 1 |
The pooled variance is s_p² = [(n₁ − 1)s₁² + (n₂ − 1)s₂²]/(n₁ + n₂ − 2). For a contingency table the expected count of a cell is (row total × column total)/grand total, and the 5% critical value of χ² with one degree of freedom is 3.841. The F ratio of variances is also what analysis of variance (ANOVA) uses to compare more than two means at once, by setting the variance between group means against the variance within groups.
3. Statistical power and sample size estimation
The power of a test, 1 − β, is the probability of rejecting H₀ when a specified true effect δ exists. It grows with the sample size n, with the effect size δ, and with α (a laxer threshold rejects more readily), and it falls as the scatter σ grows. The standardised effect size is Cohen’s d = δ/σ. Studies are conventionally designed for 80% power (z_β = 0.842) or 90% power (z_β = 1.282).
Sample size follows by demanding that the critical value and the power point coincide. For one mean (or paired differences) with a two-tailed test, n = [(zα/2 + z_β)σ/δ]²; for two independent groups of equal size, each group needs n = 2[(zα/2 + z_β)σ/δ]². To estimate a proportion p to within a margin E, n = z²p(1 − p)/E², largest at p = 0.5. The answer is always rounded up to the next whole subject.
- Halving the detectable difference δ quadruples n, because n goes as 1/δ².
- Raising power from 80% to 90% raises (zα/2 + z_β) from 2.80 to 3.24, so n grows by about a third.
- Tightening α from 0.05 to 0.01 also raises n; loosening α lowers it, at the cost of more false alarms.
4. Linear regression and correlation analysis
With S_xx = Σ(x − x̄)², S_yy = Σ(y − ȳ)² and S_xy = Σ(x − x̄)(y − ȳ), the Pearson correlation coefficient is r = S_xy/√(S_xx S_yy), bounded by −1 ≤ r ≤ 1 and unchanged by shifting either variable or rescaling it by a positive factor. The least-squares line of y on x, which minimises the sum of squared vertical residuals, has slope b_yx = S_xy/S_xx and passes through the mean point, so its intercept is a = ȳ − b_yx x̄. The line of x on y has slope b_xy = S_xy/S_yy; the two lines are different unless |r| = 1, they cross at (x̄, ȳ), and b_yx · b_xy = r², with both coefficients carrying the sign of r.
r² is the coefficient of determination, the fraction of the variance of y that the line explains. Whether a sample r is significantly different from zero is tested with t = r√(n − 2)/√(1 − r²) on n − 2 degrees of freedom. For ranked data Spearman’s coefficient is ρ = 1 − 6Σd²/[n(n² − 1)], d being the difference in ranks. A calibration of a sensor against a reference is exactly this computation: the slope is the sensitivity, the intercept the offset, and the residual scatter the non-repeatability.
5. Matrix inversion — the adjugate and Gauss–Jordan elimination
A square matrix A has an inverse exactly when det A ≠ 0, and then A⁻¹ = adj(A)/det A, where adj(A) is the transpose of the cofactor matrix. For a 2 × 2 matrix [[a, b], [c, d]] this collapses to (1/(ad − bc))·[[d, −b], [−c, a]]: swap the diagonal, negate the off-diagonal, divide by the determinant. The rules (AB)⁻¹ = B⁻¹A⁻¹, (Aᵀ)⁻¹ = (A⁻¹)ᵀ and det(A⁻¹) = 1/det A follow directly.
Cofactors cost of the order of n! operations and are hopeless beyond 3 × 3, so numerical work uses Gauss–Jordan elimination: write the augmented matrix [A | I], apply elementary row operations until the left block becomes I, and the right block is then A⁻¹. It costs of the order of n³ operations. Partial pivoting — swapping rows so that the largest available entry in the column becomes the pivot — keeps rounding error from being amplified by division by a small number. If a zero row appears on the left, A is singular and has no inverse.
| Step | Adjugate route | Gauss–Jordan route |
|---|---|---|
| Start | A = [[2, 1], [5, 3]], det A = 6 − 5 = 1 | [2 1 | 1 0; 5 3 | 0 1] |
| Middle | adj A = [[3, −1], [−5, 2]] | R2 → R2 − 2.5R1: [2 1 | 1 0; 0 0.5 | −2.5 1] |
| Finish | A⁻¹ = [[3, −1], [−5, 2]] | R2 × 2, then R1 → (R1 − R2)/2: [1 0 | 3 −1; 0 1 | −5 2] |
Key takeaways
- α is the false-alarm probability you choose; β the probability of missing a real effect; power is 1 − β.
- z when σ is known, t on n − 1 degrees of freedom when it is estimated, paired t on the differences, χ² = Σ(O − E)²/E for counts, F for a ratio of variances.
- n = [(zα/2 + z_β)σ/δ]² for one mean, twice that per group for two; always round up.
- b_yx = S_xy/S_xx, the line passes through (x̄, ȳ), and b_yx · b_xy = r².
- A⁻¹ = adj A/det A for small matrices; [A | I] → [I | A⁻¹] by Gauss–Jordan for anything larger.
Practice questions (13)
Attempt each one before opening the answer. Every explanation names the tempting wrong option as well as the right one, because that is where marks are lost.
In a hypothesis test, a Type I error is
Show answer
Answer: A — rejecting H₀ when H₀ is true
A Type I error is a false alarm — rejecting a null hypothesis that is actually true — and its probability is the significance level α. Failing to reject a false H₀ is the Type II error, probability β; accepting a true H₁ is a correct decision.Keeping α and the true effect fixed, which change increases the power of a test?
Show answer
Answer: A — Increasing the sample size
A larger n shrinks the standard error σ/√n, so the same true difference sits more standard errors from H₀ and is detected more often. Larger σ does the opposite, and abandoning pairing puts the between-subject scatter back into the denominator, which lowers power.A pressure sensor’s readings have a known standard deviation σ = 12 mmHg. For n = 36 readings of a reference at nominally 100 mmHg the sample mean is 104 mmHg. The z statistic for H₀: μ = 100 mmHg is ____.
Numerical answer — type the value.
Show answer
Answer: 2
z = (x̄ − μ₀)/(σ/√n) = (104 − 100)/(12/6) = 4/2 = 2. Forgetting the √n and dividing by σ alone gives 0.33, which would wrongly suggest no evidence against H₀; with |z| = 2 > 1.96 the two-tailed test rejects at 5%.A paired study of a new cuffless blood-pressure monitor expects the standard deviation of the paired differences to be 10 mmHg and must detect a mean difference of 5 mmHg with a two-tailed α = 0.05 and 80% power (take zα/2 = 1.96 and z_β = 0.84). The minimum number of subjects is ____.
Numerical answer — type the value.
Show answer
Answer: 32
n = [(zα/2 + z_β)σ/δ]² = [(1.96 + 0.84) × 10/5]² = (5.6)² = 31.36, rounded up to 32. Rounding to the nearest integer gives 31, which falls short of 80% power; using the two-group formula (twice this) gives 63 per group, which is not a paired design.The two regression coefficients of a data set are b_yx = 0.8 and b_xy = 0.45. The correlation coefficient r is ____.
Numerical answer — type the value.
Show answer
Answer: 0.6
b_yx · b_xy = r², so r² = 0.8 × 0.45 = 0.36 and r = +0.6, positive because both coefficients are positive. Taking the arithmetic mean of the two coefficients (0.625) is the tempting slip; r is their geometric mean.Five calibration points (x, y) are (1, 2), (2, 4), (3, 5), (4, 4) and (5, 5). Using the least-squares line of y on x, the predicted y at x = 6 is ____.
Numerical answer — type the value.
Show answer
Answer: 5.8
x̄ = 3, ȳ = 4. S_xy = (−2)(−2) + (−1)(0) + 0(1) + 1(0) + 2(1) = 6 and S_xx = 4 + 1 + 0 + 1 + 4 = 10, so b = 0.6 and a = 4 − 0.6 × 3 = 2.2. At x = 6, y = 2.2 + 3.6 = 5.8. Extending the last observed step instead gives 6, which is not a least-squares prediction.Which statements about the Pearson correlation coefficient r are correct?
Show answer
Answer: A — −1 ≤ r ≤ 1; C — r is unchanged if x is replaced by 3x + 7; D — both regression coefficients have the same sign as r
r is bounded by ±1, is invariant to a change of origin and a positive change of scale, and shares its sign with S_xy and therefore with both regression slopes. r = 0 rules out only a linear relationship — y = x² on a symmetric range has r = 0 yet y is fixed by x.A chi-square test of independence is applied to a contingency table with 3 rows and 4 columns. The number of degrees of freedom is
Show answer
Answer: A — 6
For an r × c table the degrees of freedom are (r − 1)(c − 1) = 2 × 3 = 6. Twelve is the number of cells and 11 is cells minus one, the goodness-of-fit count, which does not account for the row and column totals both being fixed.A paired t-test is the appropriate test when
Show answer
Answer: A — the same subjects are measured before and after an intervention
Pairing is for repeated measurements on the same subjects, so each subject acts as its own control and the test runs on the differences. Unrelated groups need the two-sample t-test, counts need chi-square and a ratio of variances needs the F-test.For A = [[4, 7], [2, 6]], the element in row 1, column 2 of A⁻¹ is ____.
Numerical answer — type the value.
Show answer
Answer: -0.7
det A = 24 − 14 = 10 and A⁻¹ = (1/10)[[6, −7], [−2, 4]], so the (1, 2) element is −7/10 = −0.7. Forgetting to negate the off-diagonal gives +0.7, and forgetting to divide by the determinant gives −7; multiplying back, A·A⁻¹ = I, confirms −0.7. Type the answer as -0.7.In Gauss–Jordan inversion the augmented matrix [A | I] is row-reduced until the left block is the identity. The right block is then
Show answer
Answer: A — A⁻¹
Every row operation is a left-multiplication by an elementary matrix, and the product E of all of them satisfies EA = I, so E = A⁻¹ — and the same operations applied to I leave E·I = A⁻¹ on the right. The adjugate would appear only if the determinant were never divided out.For a study comparing two means, which changes increase the required sample size, all else unchanged?
Show answer
Answer: A — a smaller difference to be detected; B — a higher required power; D — a larger standard deviation of the measurement
n ∝ [(zα/2 + z_β)σ/δ]²: a smaller δ, a larger σ and a larger z_β (higher power) all raise it. Raising α lowers zα/2 from 1.96 to 1.645 and so reduces n — a laxer threshold needs fewer subjects, paid for in false alarms.Ten patients’ heart rates are recorded before and after a drug. The mean of the ten differences is 3 beats/min and their sample standard deviation is 4 beats/min. The paired t statistic, to two decimal places, is ____.
Numerical answer — type the value.
Show answer
Answer: 2.37
t = d̄/(s_d/√n) = 3/(4/√10) = 3/1.265 = 2.37 on 9 degrees of freedom. It exceeds the two-tailed 5% value 2.262, so the change is significant. Dividing by s_d without √n gives 0.75; using √9 instead of √10 gives 2.25 and the wrong conclusion.