At x* = 75 for Northfield (s = 9.642, n = 8, x̄ = 69.375, SS_xx = 4,531.875, t₀.₀₂₅;₆ = 2.447), compute ŷ, the 95 % interval for the mean response and the 95 % prediction interval.
At x* = 75 for Northfield (s = 9.642, n = 8, x̄ = 69.375, SS_xx = 4,531.875, t₀.₀₂₅;₆ = 2.447), compute ŷ, the 95 % interval for the mean response and the 95 % prediction interval.
Answer
import math b0, b1, s, ss_xx, n, xbar = 544.1767, 2.0659, 9.642, 4531.875, 8, 69.375 x_star, t_crit = 75, 2.447 # t(0.025; 6) yhat = b0 + b1 * x_star core = 1 / n + (x_star - xbar) ** 2 / ss_xx se_mean = s * math.sqrt(core) se_pred = s * math.sqrt(1 + core) lo_m, hi_m = yhat - t_crit * se_mean, yhat + t_crit * se_mean lo_p, hi_p = yhat - t_crit * se_pred, yhat + t_crit * se_pred print(f"yhat={yhat:.2f} CI mean: {lo_m:.2f} to {hi_m:.2f} PI: {lo_p:.2f} to {hi_p:.2f}")
BCc ch 8 (the prediction interval’s extra 1); IBS1 §13.6 (extrapolation), CC BY 4.0; IS1 §12.5; H-W3; original dataset