Section B.4 Inference with Regression
In real applications, we have access to a set of observations from which we can compute the least squares line, but the population regression line is unobserved. So our regression line is one of many that could be estimated. A different sample would produce a different regression line. The same sort of ideas that we introduced when discussing the estimation of sample means or proportions also apply here. If we estimate \(b_0\) and \(b_1\) from a particular sample, then our estimates won’t be exactly equal to \(b_0\) and \(b_1\) in the population. But if we could average the estimates obtained over a very large number of datasets, the average of these estimates would equal the coefficients of the regression line in the population.
We can compute standard errors for the regression coefficients to quantify our uncertainty about these estimates. These standard errors can in turn be used to produce confidence intervals. This would require us to assume that the residuals are normally distributed. For a simple regression model, you are assuming that the values of Y are approximately normally distributed for each level of X. In those circumstances we can trust the confidence intervals that we can draw around the regression line.
You can also then perform a standard hypothesis test on the coefficients. As we saw before when summarising the model, R will compute the standard errors and a t test for each of the coefficients.
summary(fit_1)$coefficients
## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 6.183 0.09844 62.81 0.000e+00 ## RD90 3.771 0.09846 38.30 6.536e-263
In our example, we can see that the coefficient for our predictor here is statistically significant.
We can also obtain confidence intervals for the estimated coefficients using the
confint() function:
confint(fit_1)
## 2.5 % 97.5 % ## (Intercept) 5.990 6.376 ## RD90 3.578 3.964
