From the definition of the linear regression model there is one other parameter to be estimated: the residual variance . We estimate this using the variance of the estimated residuals.
The estimated residuals are defined as,
(7.5) |
and we estimate by
The heuristic reason for dividing by , rather than , is that although the sum is over residuals these are not independent since each is a function of the parameter estimates . Dividing by then gives an unbiased estimate of the residual variance. This is the same reason that we divide by , rather than , to get the sample variance. The square root of the residual variance, , is referred to as the residual standard error.
Returning to the simple linear regression on birth weight. To calculate the residuals we subtract the fitted birth weights from the observed birth weights. The birth weights are
,
,
…
What are the residuals?
The estimated residuals are
,
,
…
What is the estimate of the residual variance?
Since and ,
The estimated residuals can also be obtained from the lm fit in R,
So we can calculate the residual variance as
Why is this estimate slightly different to the one obtained previously?
We used rounded values of to calculate the estimates. In fact, when we look at the residual standard error (), the error made by using rounded estimates is much smaller.
Finally, lm also gives the residual standard error directly, via the summary function,
summary is a very useful command, for example it allows you to view the parameter estimates of a fitted model. We will use it more later in the course.