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:

  1. Fit simple linear regression models in R using the function lm()
  2. Use diagnostic plots to check model residuals for violations of assumptions
  3. Use predict() to calculate predicted values, confidence intervals, and prediction intervals
  4. 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.

R logo

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().

Video - STAT 485 Lesson: 11.1

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.

Video - STAT 485 Lesson: 11.2

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.

Video - STAT 485 Lesson: 11.3

11.5 Testing Hypotheses About Regression Parameters (II)

We continue our duscussion of testing hypotheses about regession parameters.

Video - STAT 485 Lesson: 11.4

11.6 Testing Hypotheses About Regression Parameters (III)

We’ll conclude our discussion about testing regression parameters.

Video - STAT 485 Lesson: 11.5

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.

Video - STAT 485 Lesson: 11.6

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.

Video - STAT 485 Lesson: 11.7