Worked Problems for Unit 3: Statistics, Inference and Regression
2. Probability: Bayes' theorem, the binomial and the normal distribution
Bayes. A disease affects 1% of a population. A test detects it in 95% of the sick (sensitivity) and wrongly flags 5% of the healthy. A person tests positive. The probability of being sick given a positive is P(D|+) = P(+|D)P(D) / [P(+|D)P(D) + P(+|not D)P(not D)] = (0.95 × 0.01) / (0.95 × 0.01 + 0.05 × 0.99) = 0.0095 / 0.0590 = 0.161. Only about one positive in six is truly sick, because the healthy are so numerous that their 5% false alarms outnumber the true cases: 495 false positives against 95 true positives in every 10,000 people.
Binomial. With n = 5 independent trials and success probability 0.3, P(X = 2) = C(5, 2) × 0.3² × 0.7³ = 10 × 0.09 × 0.343 = 0.3087; the mean is np = 1.5 and the variance npq = 5 × 0.3 × 0.7 = 1.05. Normal. If X is normal with mean 50 and standard deviation 10, then P(40 < X < 65) = Φ(1.5) − Φ(−1) = 0.9332 − 0.1587 = 0.7745, because 65 is 1.5 standard deviations above the mean and 40 is one below. A useful anchor: about 68% of a normal distribution lies within one standard deviation of the mean, 95% within 1.96, and 99.7% within three.
| Problem | Answer |
|---|---|
| P(sick | 0.161 |
| Binomial P(X = 2), n = 5, p = 0.3 | 0.3087 |
| Binomial mean and variance | 1.5 and 1.05 |
| Normal P(40 < X < 65), N(50, 10²) | 0.7745 |
Bayes. A disease affects 1% of a population. A test detects it in 95% of the sick (sensitivity) and wrongly flags 5% of the healthy. A person tests positive. The probability of being sick…
3. The central limit theorem at work: standard error, confidence interval and test
A sample of n = 64 has mean 52, and the population standard deviation is σ = 16. The standard error of the mean is σ/√n = 16/8 = 2. By the central limit theorem the sample mean is approximately normal whatever the shape of the population, so a 95% confidence interval is 52 ± 1.96 × 2 = (48.08, 55.92). To test H0: μ = 50 against H1: μ ≠ 50, the statistic is z = (52 − 50)/2 = 1.0, the two-sided p-value is 0.317, and since |z| < 1.96 the null is not rejected at 5%. The interval agrees: 50 lies inside it. Confidence interval and two-sided test are the same information read two ways.
Now suppose σ is unknown and n = 16 with sample standard deviation s = 8 and the same mean 52. The standard error is 8/4 = 2 again, but the reference distribution is Student's t with 15 degrees of freedom, whose 5% two-sided critical value is 2.131, wider than 1.96 because estimating σ adds uncertainty. The interval is 52 ± 2.131 × 2 = (47.74, 56.26) and t = 1.0 gives a p-value of 0.333. Finally, the sample size needed for a margin of error of 2 at 95% confidence with σ = 16 is n = (1.96 × 16/2)² = 245.9, which is rounded up to 246: rounding down would leave the margin above 2.
| Item | z, n = 64, σ = 16 known | t, n = 16, s = 8 |
|---|---|---|
| Standard error | 2 | 2 |
| Critical value (5%, two-sided) | 1.96 | 2.131 (15 d.f.) |
| 95% interval | (48.08, 55.92) | (47.74, 56.26) |
| Test statistic | z = 1.0 | t = 1.0 |
| p-value | 0.317 | 0.333 |
| Decision | Do not reject | Do not reject |
- Standard error σ/√n16/8 = 2
- 95% interval: mean ± 1.96 × SE(48.08, 55.92)
- Test statistic z(52 − 50)/2 = 1.0
- |z| < 1.96: do not reject50 lies inside the interval
A sample of n = 64 has mean 52, and the population standard deviation is σ = 16. The standard error of the mean is σ/√n = 16/8 = 2. By the central limit theorem the sample mean is…
4. Ordinary least squares by hand: slope, intercept, R-squared and the t-test
Five observations: X = 1, 2, 3, 4, 5 and Y = 3, 5, 4, 7, 8. The means are X̄ = 3 and Ȳ = 5.4. Then Sxx = Σ(X − X̄)² = 4 + 1 + 0 + 1 + 4 = 10, Sxy = Σ(X − X̄)(Y − Ȳ) = (−2)(−2.4) + (−1)(−0.4) + 0 + (1)(1.6) + (2)(2.6) = 4.8 + 0.4 + 1.6 + 5.2 = 12, and Syy = 17.2. The OLS slope is b = Sxy/Sxx = 1.2 and the intercept is a = Ȳ − bX̄ = 5.4 − 3.6 = 1.8, so the fitted line is Ŷ = 1.8 + 1.2X. The fitted values are 3.0, 4.2, 5.4, 6.6, 7.8 and the residuals are 0, 0.8, −1.4, 0.4, 0.2, which sum to zero as OLS residuals must when there is an intercept.
The residual sum of squares is 0 + 0.64 + 1.96 + 0.16 + 0.04 = 2.8, so R² = 1 − 2.8/17.2 = 0.837: the line explains about 84% of the variation in Y. The standard error of the slope is √[(RSS/(n − 2))/Sxx] = √[(2.8/3)/10] = √0.0933 = 0.3055, so t = 1.2/0.3055 = 3.93. With n − 2 = 3 degrees of freedom the 5% critical value is 3.182, and 3.93 exceeds it, so the slope is significant. A simple regression's R² equals the square of the correlation, 0.915² = 0.837. A forecast at X = 6 is 1.8 + 1.2 × 6 = 9.0, an extrapolation beyond the data and therefore less reliable than an interpolation.
| Quantity | Value |
|---|---|
| Slope b | 1.2 |
| Intercept a | 1.8 |
| Residual sum of squares | 2.8 |
| R² | 0.837 |
| Standard error of b | 0.3055 |
| t-statistic for b | 3.93 (critical 3.182 at 3 d.f.) |
| Forecast at X = 6 | 9.0 |
Five observations: X = 1, 2, 3, 4, 5 and Y = 3, 5, 4, 7, 8. The means are X̄ = 3 and Ȳ = 5.4. Then Sxx = Σ(X − X̄)² = 4 + 1 + 0 + 1 + 4 = 10, Sxy = Σ(X − X̄)(Y − Ȳ) = (−2)(−2.4) +…
5. Index numbers: Laspeyres, Paasche and Fisher
Three goods have base-year prices 10, 20 and 5 with quantities 4, 2 and 10, and current-year prices 12, 25 and 6 with quantities 5, 3 and 6. The Laspeyres price index weights by base-year quantities: Σp1q0/Σp0q0 × 100 = (12 × 4 + 25 × 2 + 6 × 10)/(10 × 4 + 20 × 2 + 5 × 10) × 100 = 158/130 × 100 = 121.54. The Paasche index weights by current-year quantities: Σp1q1/Σp0q1 × 100 = (60 + 75 + 36)/(50 + 60 + 30) × 100 = 171/140 × 100 = 122.14. Fisher's ideal index is their geometric mean, √(121.54 × 122.14) = 121.84.
Here Paasche is above Laspeyres only because consumers moved toward the goods whose prices rose most in relative terms; ordinarily buyers substitute away from dearer goods, so Laspeyres tends to overstate the rise in the cost of living and Paasche to understate it, and the Fisher index lies between them. The Fisher index also passes the time-reversal test (swap the two years and the index becomes the reciprocal) and the factor-reversal test, which is why it is called ideal. Neither Laspeyres nor Paasche passes the time-reversal test.
| Index | Formula | Value |
|---|---|---|
| Laspeyres | Σp1q0 / Σp0q0 × 100 | 121.54 |
| Paasche | Σp1q1 / Σp0q1 × 100 | 122.14 |
| Fisher | √(Laspeyres × Paasche) | 121.84 |
Three goods have base-year prices 10, 20 and 5 with quantities 4, 2 and 10, and current-year prices 12, 25 and 6 with quantities 5, 3 and 6. The Laspeyres price index weights by base-year…
Key takeaways
- Sample variance divides the sum of squared deviations by n − 1: for 12, 15, 11, 18, 14, 15, 20, 15, 9, 16 the mean is 14.5, the sum of squares 94.5, the sample variance 10.5 and the coefficient of variation 22.3%.
- Bayes' theorem shows why a positive result from an accurate test for a rare condition is usually a false alarm: with 1% prevalence, 95% sensitivity and 5% false positives, P(sick | positive) = 0.161.
- The standard error is σ/√n; with σ = 16 and n = 64 it is 2, the 95% interval for a mean of 52 is (48.08, 55.92), and replacing σ by an estimate means using t, whose critical value (2.131 at 15 d.f.) is larger than 1.96.
- OLS slope is Sxy/Sxx and the intercept is Ȳ − bX̄; for the five-point data b = 1.2, a = 1.8, R² = 0.837, the slope's standard error is 0.3055 and t = 3.93, which exceeds the 3.182 critical value at 3 d.f.
- Laspeyres uses base-year quantities and tends to overstate price rises, Paasche uses current-year quantities and tends to understate them, and the Fisher index, their geometric mean, passes the time-reversal test.
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.
For the data 12, 15, 11, 18, 14, 15, 20, 15, 9, 16, the median and the mode are:
Show answer
Answer: B — 15 and 15
Sorted, the fifth and sixth values are both 15, so the median is 15; 15 appears three times, so it is also the mode. The mean, not the median, is 14.5.The sum of squared deviations for that data is 94.5. The sample standard deviation is approximately:
Show answer
Answer: C — 3.24
The sample variance is 94.5/9 = 10.5 and its square root is 3.24. The value 3.07 divides by n = 10 (population version), and 10.5 is the variance, not the standard deviation.A disease has 1% prevalence; a test has 95% sensitivity and a 5% false-positive rate. The probability that a person who tests positive is sick is about:
Show answer
Answer: D — 16%
Bayes' theorem gives 0.0095/(0.0095 + 0.0495) = 0.161. The 95% is the reverse conditional probability, P(positive | sick), which is the common confusion.
Show the other 21 questions
For a binomial with n = 5 and p = 0.3, P(X = 2) equals:
Show answer
Answer: A — 0.3087
C(5, 2) × 0.3² × 0.7³ = 10 × 0.09 × 0.343 = 0.3087. The value 0.09 forgets both the coefficient and the failures' probability.If X ~ N(50, 10²), P(40 < X < 65) is approximately:
Show answer
Answer: B — 0.7745
The limits are z = −1 and z = 1.5, so the probability is 0.9332 − 0.1587 = 0.7745. The 0.6827 is the symmetric ±1 SD case.A sample of 64 has mean 52 and σ = 16 is known. The 95% confidence interval for the population mean is:
Show answer
Answer: C — (48.08, 55.92)
SE = 16/8 = 2, and 1.96 × 2 = 3.92, so the interval is 52 ± 3.92. The wide (36, 68) uses σ itself in place of the standard error.In that sample, the test of H0: μ = 50 against H1: μ ≠ 50 at the 5% level:
Show answer
Answer: D — Does not reject H0, since z = 1.0
z = (52 − 50)/2 = 1.0, below 1.96. The z = 2.0 option forgets to divide by the standard error. Comparing z with 0.05 mixes up a test statistic with a significance level.For X = 1…5 and Y = 3, 5, 4, 7, 8 the OLS fitted line is:
Show answer
Answer: A — Y = 1.8 + 1.2X
b = Sxy/Sxx = 12/10 = 1.2 and a = 5.4 − 1.2 × 3 = 1.8. The line Y = 1.2 + 1.8X swaps slope and intercept.The R² of that regression is approximately:
Show answer
Answer: B — 0.837
R² = 1 − RSS/TSS = 1 − 2.8/17.2 = 0.837. The value 0.915 is the correlation coefficient r, the square root of R².With base-year prices 10, 20, 5 and quantities 4, 2, 10, and current prices 12, 25, 6, the Laspeyres price index is approximately:
Show answer
Answer: C — 121.5
Σp1q0 = 48 + 50 + 60 = 158 and Σp0q0 = 40 + 40 + 50 = 130, so the index is 158/130 × 100 = 121.5. The numbers 158 and 130 are the numerator and denominator.The arithmetic mean of 4, 8, 10, 14 and 24 is:
Show answer
Answer: C — 12
Mean = (4 + 8 + 10 + 14 + 24)/5 = 60/5 = 12. 10 is the median (the middle value), which candidates give when the series is skewed by one large value; 60 is the sum before dividing.A distribution has mean 50 and standard deviation 10. Its coefficient of variation is:
Show answer
Answer: B — 20 per cent
CV = (σ/mean) × 100 = 10/50 × 100 = 20 per cent; it is unit-free, so it compares variability across series with different means. Inverting the ratio (mean/σ = 5) is the tempting slip.In a village, 40 per cent of households are landless. Of the landless households 60 per cent are below the poverty line, and of the landed households 20 per cent are. The probability that a randomly chosen household is below the poverty line is:
Show answer
Answer: B — 0.36
Total probability: 0.4 × 0.6 + 0.6 × 0.2 = 0.24 + 0.12 = 0.36. Averaging 60 and 20 per cent (0.40) ignores the unequal group sizes, 0.24 counts only the landless poor, and 0.80 simply adds the two conditional rates.An export consignment is delayed at the port with probability 0.3 and at customs with probability 0.2, independently. The probability that it faces no delay at either point is:
Show answer
Answer: A — 0.56
For independent events P(no delay at both) = (1 − 0.3)(1 − 0.2) = 0.7 × 0.8 = 0.56. Subtracting the sum of the two probabilities from one (0.50) wrongly treats the delays as mutually exclusive, 0.06 is the chance of delay at both, and 0.44 is the chance of at least one delay.Monthly household expenditure in a district has a standard deviation of ₹1,200. A random survey of 144 households estimates mean expenditure. The standard error of that estimate is:
Show answer
Answer: D — ₹100
SE = σ/√n = 1,200/√144 = 1,200/12 = ₹100. Dividing by n instead of √n gives ₹8.33, ₹1,200 is the population standard deviation itself, and ₹10,000 is σ²/n — variance logic with standard-deviation units.In a simple linear regression of Y on X, the correlation coefficient between X and Y is 0.8. The coefficient of determination is:
Show answer
Answer: B — 0.64
In simple regression R² = r² = 0.64, so X explains 64 per cent of the variation in Y. 0.8 is r itself, 0.89 is √0.8, and 0.36 = 1 − r² is the unexplained share.Base-year prices of three goods are 10, 20 and 5; current prices are 12, 25 and 6; current-year quantities are 2, 4 and 10. The Paasche price index is about:
Show answer
Answer: A — 122.7
Paasche = Σp1q1/Σp0q1 × 100 = (24 + 100 + 60)/(20 + 80 + 50) × 100 = 184/150 × 100 ≈ 122.7, weighting by current quantities. 81.5 inverts the ratio, and 184 is the current-year expenditure, not an index. Laspeyres would use base-year quantities instead.An exporter finds that 10 per cent of consignments are rejected, independently of one another. For a lot of 50 consignments, the mean and variance of the number rejected are:
Show answer
Answer: D — 5 and 4.5
The count is binomial: mean = np = 50 × 0.1 = 5 and variance = np(1 − p) = 5 × 0.9 = 4.5. 2.12 is the standard deviation (√4.5), not the variance; 0.5 multiplies by p again instead of (1 − p); 45 is the mean number accepted.For a sample, Cov(X, Y) = 12, Var(X) = 4, mean of X = 5 and mean of Y = 20. The OLS regression of Y on X is:
Show answer
Answer: C — Ŷ = 5 + 3X
b = Cov(X, Y)/Var(X) = 12/4 = 3 and a = Ȳ − bX̄ = 20 − 15 = 5. Using the mean of Y as the intercept ignores the slope adjustment, and 0.33 is Var/Cov, the inverted slope; 35 adds bX̄ instead of subtracting it.Arrivals at a counter follow a Poisson distribution with a mean of 2 per minute. The probability of no arrival in a given minute is about:
Show answer
Answer: A — 0.135
P(X = 0) = e^(−λ)λ⁰/0! = e^(−2) ≈ 0.135. 0.271 is P(X = 1) = 2e^(−2), the adjacent term candidates pick, and 0.5 = 1/λ confuses the Poisson with the mean waiting time.To estimate a population mean within ±3 at 95 per cent confidence when σ = 15, the minimum sample size is:
Show answer
Answer: D — 97
n = (zσ/E)² = (1.96 × 15/3)² = 9.8² = 96.04, rounded up to 97 because a sample of 96 would leave the margin slightly above 3. Rounding down to 96 is the usual slip, 10 is zσ/E before squaring, and 25 uses (σ/E)² without z.Eight states are ranked by per-capita income and by literacy rate, and the sum of squared rank differences is Σd² = 21. Spearman's rank correlation coefficient is:
Show answer
Answer: C — 0.75
rs = 1 − 6Σd²/[n(n² − 1)] = 1 − 126/(8 × 63) = 1 − 126/504 = 0.75. 0.25 stops at the fraction without subtracting it from one, 0.96 drops the 6 from the numerator (1 − 21/504), and a negative value would need the two rankings to run in opposite directions.A regression with 4 explanatory variables (plus an intercept) estimated on 25 observations has R² = 0.80. The adjusted R² is:
Show answer
Answer: D — 0.76
Adjusted R² = 1 − (1 − R²)(n − 1)/(n − k − 1) = 1 − 0.2 × 24/20 = 1 − 0.24 = 0.76; it penalises extra regressors, so it is below R². 0.84 adds the penalty in the wrong direction, and 0.77 uses n − k = 21 in the denominator instead of n − k − 1 = 20.Given below are two statements. Statement I: With the sample size fixed, lowering the significance level α of a test raises the probability of a Type II error. Statement II: The power of a test equals 1 − α. In the light of the above statements, choose the correct answer:
Show answer
Answer: D — Statement I is true but Statement II is false
A stricter α widens the acceptance region, so a false null is accepted more often: β rises. Power is 1 − β, the probability of rejecting a false null, not 1 − α (which is the probability of correctly accepting a true null). Confusing the two error probabilities produces the "both true" choice.