Multiple Linear Regression
Multiple Linear Regression
Multiple Linear Regression
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
2.8 How to do it with RTo get confidence intervals for the parameters we need only use confint:> confint(trees.lm)2.5 % 97.5 %(Intercept) -75.68226247 -40.2930554Girth 4.16683899 5.2494820Height 0.07264863 0.6058538For example, using the calculations above we say that for the regression model Volume~Girth + Height we are 95% confident that the parameter β 1 lies somewhere in the interval[4.2, 5.2].2.9 Confidence and Prediction IntervalsWe use confidence and prediction intervals to gauge the accuracy of our parameter estimates.We know Ŷ(x 0 ) = x T 0b, and we also know(b ∼ mvnorm mean = β, sigma = σ ( 2 X T X ) ) −1, (27)so we get(Ŷ(x 0 ) ∼ mvnorm mean = x T 0 β, sigma = ( σ2 x T 0 X T X ) )−1x0 . (28)and confidence intervals for the mean value of a future observation at the location x 0 = [ x 10 x 20 . . . x p0] Tare given byŶ(x 0 ) ± t α/2 (df = n − p − 1) SPrediction intervals for a new observation at x 0 are given byŶ(x 0 ) ± t α/2 (df = n − p − 1) S√x T (0 XT X ) −1 x 0 . (29)√1 + x T (0 XT X ) −1 x 0 . (30)Note that the prediction intervals are wider than the confidence intervals.2.10 How to do it with R> new