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.
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̄ −…
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.
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…
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.
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…
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] |
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…
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 (24)
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%.
Show the other 21 questions
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.The p-value of a hypothesis test is
Show answer
Answer: D — The probability, assuming H₀ is true, of obtaining a result at least as extreme as the one observed
The p-value is computed under H₀ and measures how surprising the data are. Reading it as the probability that H₀ is true is the tempting and very common error; a frequentist test gives no such probability. The level α is fixed in advance and the p-value is compared with it.A clinical study is designed with α = 0.05 and a Type II error probability β = 0.20. The power of the study is
Show answer
Answer: C — 0.80
Power is the probability of rejecting a false H₀, the complement of a Type II error: 1 − β = 0.80. 0.95 is tempting, but 1 − α is the probability of correctly retaining a true H₀; 0.75 wrongly subtracts both error rates from 1.Which of the following cannot be the value of a Pearson correlation coefficient?
Show answer
Answer: A — 1.2
r always lies in [−1, 1], so 1.2 is impossible. −0.95 may look suspicious because it is negative, but it simply means a strong inverse linear relation; r = 1 is a perfect positive line.The matrix A = [[2, 4], [1, 2]] has no inverse because
Show answer
Answer: A — Its determinant is zero
det A = 2 × 2 − 4 × 1 = 0, because row 1 is twice row 2; a square matrix is invertible exactly when its determinant is non-zero. Lack of symmetry is tempting, but most invertible matrices are not symmetric.A pooled two-sample t-test compares groups of 10 and 12 patients. The degrees of freedom of the test statistic are ____.
Numerical answer — type the value.
Show answer
Answer: 20
df = n₁ + n₂ − 2 = 10 + 12 − 2 = 20, one degree lost for each estimated mean. 21 (= n − 1 for the combined sample) is the tempting slip.For A = [[1, 2, 0], [0, 1, 3], [2, 0, 1]], the element in row 1, column 1 of A⁻¹, to three decimal places, is ____.
Numerical answer — type the value.
Show answer
Answer: 0.077
det A = 1(1) − 2(0 − 6) + 0 = 13 and the cofactor C₁₁ = 1 × 1 − 3 × 0 = 1, so (A⁻¹)₁₁ = C₁₁/det = 1/13 = 0.077. Taking the reciprocal of the element itself (1/1 = 1) is the tempting slip; inverse elements come from cofactors divided by the determinant.For paired data, r = 0.6, the standard deviation of y is 10 and that of x is 5. The slope of the least-squares regression line of y on x is ____.
Numerical answer — type the value.
Show answer
Answer: 1.2
b_yx = r s_y/s_x = 0.6 × 10/5 = 1.2. Inverting the ratio gives 0.3, which is b_xy, the slope of x on y — the tempting slip.A sample of 36 readings has mean 105; the population standard deviation is known to be 15. The z statistic for testing H₀: µ = 100 is ____.
Numerical answer — type the value.
Show answer
Answer: 2
z = (x̄ − µ₀)/(σ/√n) = 5/(15/6) = 2. Dividing by σ instead of the standard error gives 0.33, the tempting slip that ignores the sample size.A calibration of a sensor against a reference gives r = −0.8. The fraction of the variance in the sensor reading explained by the linear fit is
Show answer
Answer: A — 64 %
The coefficient of determination is r² = 0.64, i.e. 64 %, whatever the sign of r. 80 % is tempting because |r| = 0.8, but r itself is not a proportion of variance; a variance fraction cannot be negative.The mean heart rate is to be compared across four drug-dose groups. Running all six pairwise t-tests at α = 0.05 is discouraged because
Show answer
Answer: B — The family-wise Type I error rate rises well above 0.05; one-way ANOVA tests all means at once
With six tests the chance of at least one false positive is up to 1 − 0.95⁶ ≈ 0.26 if the tests were independent, so ANOVA (followed by corrected post-hoc tests) is used. The chi-square option is tempting because it handles several groups, but it compares counts or proportions, not means.A one-sided z-test at α = 0.05 (critical z = 1.645) uses n = 25 subjects with known σ = 10. If the true mean exceeds the null value by 5, the power of the test, to two decimal places, is ____.
Numerical answer — type the value.
Show answer
Answer: 0.80
SE = 10/√25 = 2, so the true effect is 5/2 = 2.5 standard errors. Power = Φ(2.5 − 1.645) = Φ(0.855) ≈ 0.80. Using σ instead of SE gives Φ(0.5 − 1.645) ≈ 0.13, the tempting slip.