11 Linear Regression
Overview
In this first chapter of part II, we will begin with fitting simple regression using the function lm()
. We’ll also look at satisying regression assumptions, making predictions from models, and testing hypotheses about regression parameters.
Objectives
Upon completion of this lesson, you should be able to:
- Fit simple linear regression models in R using the function
lm()
- Use diagnostic plots to check model residuals for violations of assumptions
- Use
predict()
to calculate predicted values, confidence intervals, and prediction intervals - Test hypotheses about regression parameters
Data and R Code Files
The R code file and data files for this lesson can be found on the Essential R - Notes on learning R page.
11.1 The Regression Model and Interpreting the Output
The function lm()
(for “linear model”) is the basis for fitting a wide array of models in R - regression, ANOVA, ANCOVA. We’ll introduce basic use of lm()
and discuss interpretation of the results()
.
11.2 Meeting Regression Assumptions - Normality of Residuals
It is so simple to fit a model that it can be easy to forget that we should check to make sure that regression assumptions have been met. Here we’ll discuss assessing the normality of residuals.
11.3 Meeting Regression Assumptions - Homogeneity of Residuals
We continue our discussion about meeting regression assumptions by looking at the violation of the assumption of homogeneity of variance. Note that there are two videos on this page and that they are a “wide” format.
11.3.1 Video STAT 485 Lesson: 11.3a
11.3.2 Video STAT 485 Lesson: 11.3b
11.4 Testing Hypotheses About Regression Parameters (I)
Sometimes we approach data with specific questions or hypotheses. In this video we’ll show how we can test hypotheses about the values of regression parameters.
11.5 Testing Hypotheses About Regression Parameters (II)
We continue our duscussion of testing hypotheses about regession parameters.
11.6 Testing Hypotheses About Regression Parameters (III)
We’ll conclude our discussion about testing regression parameters.
11.7 Predicting Values and Confidence Intervals from Regressions
In this video we’ll introduce the function predict() for making predictions from linear models and also show how it can be used to calculate confidence intervals about the regression line.
11.8 Prediction Intervals from Regressions
We’ll wrap up Chapter 11 by showing how prediction intervals can be calcualted, and how they differ from confidence intervals.