Skip to content
The Lumenary

Each worksheet prints cleanly on A4 or Letter. Answer keys are on a separate page.

The Lumenary · Early undergraduate

Statistical inference

Name: ______________________

Date: ______________________

You will learn to

  • Define estimators and assess their bias, variance and mean squared error; prove that the sample mean and the sample variance with n−1n - 1 are unbiased
  • Write down likelihoods and derive maximum likelihood estimators, and state the Cramér–Rao bound
  • Construct confidence intervals and perform hypothesis tests, interpreting confidence levels and p-values correctly
  • Explain type I and type II errors and power, and why multiple testing needs a correction such as Bonferroni's
  • Fit linear regression by least squares through the normal equations X⊤Xβ=X⊤yX^\top X\beta = X^\top y, and check its assumptions with residuals
  • Compare frequentist and Bayesian inference through the beta–binomial model
  1. 1.

    A test of H0H_0: "the new fertiliser has no effect on mean yield" gives p=0.03p = 0.03. Which statement is correct?

    • A.There is a 3%3\% probability that the fertiliser has no effect.
    • B.If the fertiliser had no effect, a difference at least as large as the one observed would occur in about 3%3\% of such experiments.
    • C.The fertiliser increases the yield by 3%3\%.
    • D.If the experiment is repeated, it will give a significant result 97%97\% of the time.
  2. 2.

    A health clinic records the number of patients arriving in five consecutive hours: 3,5,2,6,43, 5, 2, 6, 4. Modelling the counts as independent Poisson(λ)(\lambda), what is the maximum likelihood estimate of λ\lambda?

  3. 3.

    Compute the sample variance S2=1n−1∑i(xi−xˉ)2S^2 = \frac{1}{n-1}\sum_i (x_i - \bar x)^2 of the data 2,4,92, 4, 9.

  4. 4.

    For an i.i.d. sample X1,…,XnX_1, \dots, X_n from the uniform distribution on [0,θ][0, \theta], the MLE is M=max⁡iXiM = \max_i X_i, and E[M]=nn+1θE[M] = \frac{n}{n+1}\theta. Which estimator is unbiased for θ\theta?

    • A.MM
    • B.n+1nM\frac{n+1}{n}M
    • C.nn+1M\frac{n}{n+1}M
    • D.M+1M + 1
  5. 5.

    In the proof that the normal equations give the least-squares solution, we expand ∥y−Xβ∥2=∥r∥2+2 r⊤Xw+∥Xw∥2\|y - X\beta\|^2 = \|r\|^2 + 2\,r^\top Xw + \|Xw\|^2 with r=y−Xβ^r = y - X\hat\beta and w=β^−βw = \hat\beta - \beta. Why does the cross term vanish?

    • A.r⊤Xw=(X⊤r)⊤wr^\top Xw = (X^\top r)^\top w and X⊤r=X⊤y−X⊤Xβ^=0X^\top r = X^\top y - X^\top X\hat\beta = 0 by the normal equations.
    • B.Because ww is small when β\beta is close to β^\hat\beta.
    • C.Because the residuals always sum to zero.
    • D.Because X⊤XX^\top X is invertible.
  6. 6.

    A study tests 88 hypotheses and obtains the p-values 0.0004, 0.003, 0.006, 0.0071, 0.011, 0.02, 0.04, 0.30.0004,\ 0.003,\ 0.006,\ 0.0071,\ 0.011,\ 0.02,\ 0.04,\ 0.3. Using the Bonferroni correction with family-wise error rate 0.050.05, how many hypotheses are rejected?

  7. 7.

    A small trial of a new treatment (20 patients) finds a 95%95\% confidence interval of [−2,15][-2, 15] days for the reduction in recovery time, with p=0.13p = 0.13. What is the best conclusion?

    • A.The treatment has no effect.
    • B.The data are compatible with no effect and also with a substantial benefit; a larger study is needed.
    • C.The treatment is harmful, since the interval contains negative values.
    • D.There is an 87%87\% chance that the treatment works.
  8. 8.

    From 260260 of 400400 households, a 95%95\% confidence interval for the proportion pp is [0.603,0.697][0.603, 0.697], and with a uniform prior the Bayesian posterior is Beta(261,141)(261, 141) with 95%95\% credible interval [0.602,0.695][0.602, 0.695]. Which statements are correct? (Choose all that apply.)

    • A.In repeated surveys, about 95%95\% of intervals computed this way would contain the true pp.
    • B.Frequentist theory says P(0.603≤p≤0.697)=0.95P(0.603 \le p \le 0.697) = 0.95 for this particular interval.
    • C.Given the model and the uniform prior, P(0.602≤p≤0.695∣data)=0.95P(0.602 \le p \le 0.695 \mid \text{data}) = 0.95.
    • D.The posterior mean is 261/402≈0.649261/402 \approx 0.649.
  9. 9.

    Which Lean statement says that a solution b of the normal equations minimises the residual sum of squares? (Xᵀ is the transpose, *ᵥ multiplies a matrix by a vector, ⬝ᵥ is the dot product.)

    • A.(hb : (Xᵀ * X) *ᵥ b = Xᵀ *ᵥ y) (β : p → ℝ) : (y - X *ᵥ b) ⬝ᵥ (y - X *ᵥ b) ≤ (y - X *ᵥ β) ⬝ᵥ (y - X *ᵥ β)
    • B.(hb : X *ᵥ b = y) (β : p → ℝ) : (y - X *ᵥ b) ⬝ᵥ (y - X *ᵥ b) ≤ (y - X *ᵥ β) ⬝ᵥ (y - X *ᵥ β)
    • C.(hb : (Xᵀ * X) *ᵥ b = Xᵀ *ᵥ y) (β : p → ℝ) : (y - X *ᵥ β) ⬝ᵥ (y - X *ᵥ β) ≤ (y - X *ᵥ b) ⬝ᵥ (y - X *ᵥ b)
    • D.(hb : (X * Xᵀ) *ᵥ b = Xᵀ *ᵥ y) (β : p → ℝ) : (y - X *ᵥ b) ⬝ᵥ (y - X *ᵥ b) ≤ (y - X *ᵥ β) ⬝ᵥ (y - X *ᵥ β)
  10. 10.

    Write fit_line(xs, ys) returning the least-squares (intercept, slope) for the model y=β0+β1xy = \beta_0 + \beta_1 x, using β^1=∑(xi−xˉ)(yi−yˉ)∑(xi−xˉ)2\hat\beta_1 = \frac{\sum (x_i - \bar x)(y_i - \bar y)}{\sum (x_i - \bar x)^2} and β^0=yˉ−β^1xˉ\hat\beta_0 = \bar y - \hat\beta_1\bar x. Use Fraction so the answers are exact. The tests also check that the residuals sum to zero and are orthogonal to xx — the normal equations.

    Computational — Practice

Code: Apache-2.0 · Content: CC BY-SA 4.0