Source: Hedderich, Sachs and Reynarowych, Applied Statistics: Methods Using R,
section 8.2.6, printed page 813, equations (8.36) and (8.37): yhat0 +/-
t_{n-p-1, 1-alpha/2} sigma sqrt(1 + x0' (X'X)^-1 x0) and the same without the
leading 1. (8.36) is the interval for a single future observation; (8.37) is the
narrower interval for a mean future value, carrying no Var(epsilon) term. sigma is
sqrt(RSS / (n - p - 1)) and p is the number of predictors excluding the
intercept.
Details
The book worked example on the same page fits litter size on body
weight and brain weight (n = 20, p = 2) and reports for
x0 = c(1, 8.0, 0.4) the estimate yhat0 = 6.37 with 95%
prediction interval 4.49 ... 8.24.
The design matrix is passed exactly as the book builds it, with its own leading column of ones, so that x0 is written the same way.
