In order to obtain a confidence interval for the coefficient estimates, we can
use the confint()
command.
> confint(lm.fit)
2.5 % 97.5 %
(Intercept) 33.448457 35.6592247
lstat -1.026148 -0.8739505
By default R uses the 95% confidence level, the level
parameter allows us to specify our own confidence level.
> confint(lm.fit, level = 0.95)
2.5 % 97.5 %
(Intercept) 33.448457 35.6592247
lstat -1.026148 -0.8739505
Try creating a 90% confidence interval for the model lm.fit
:
Assume that:
MASS
library has been loadedBoston
dataset has been loaded and attached