blackblack
picture picture

Ch 3.2: Multiple Linear Regression

Lecture 6 - CMSE 381
Michigan State University
::
Dept of Computational Mathematics, Science /span> Engineering
Mon, Jan 26, 2026
Announcements

Last time:

Announcements:

Covered in this lecture

Section 1 picture picture

Review from last time
Linear Regression with One Variable

scatter plot with linear fit and residuals
Y β0 + β1X
  • Find good guesses for β^0, β^1.
  • ŷi = β^0 + β^1xi
  • ei = yi ŷi is the ith residual
  • residual sum of squares RSS = iei2
  • left: contour plots of residual sum of
squares in beta0-beta1 plane. Right:
Three dimensional plot of RSS versus
beta0 and beta1.
    Evaluating the model

    β^1 ± 2 SE(β^1)
  • Hypothesis test:

  • Assessing the accuracy of the model

    Residual standard error (RSE): 𝑅𝑆𝐸 = 1 n 2𝑅𝑆𝑆

    R squared:

    R2 = 𝑇𝑆𝑆 𝑅𝑆𝑆 𝑇𝑆𝑆 = 1 𝑅𝑆𝑆 𝑇𝑆𝑆
    𝑇𝑆𝑆 = i(yi y¯)2

    Section 2 picture picture

    Multiple Linear Regression
    Setup

    Y = β0 + β1X1 + β2X2 + βpXp + 𝜀
    scatter plot in 3D of Y
versus X1 and X2. A planar
fit is shown with residuals
for each data point.
    Estimation and Prediction

    Given estimates β^0,β^1,β^2,,β^p, prediction is
    ŷ = β^0 + β^1x1 + + β^pxp
    Minimize the sum of squares 𝑅𝑆𝑆 = i(yi ŷi)2 = i(yi β^0 β^1xi1 β^px𝑖𝑝)2

    Coefficients are closed form but UGLY

    Advertising data set example

    𝚂𝚊𝚕𝚎𝚜 = β0 + β1 𝚃𝚅 + β2 𝚛𝚊𝚍𝚒𝚘 + β3 𝚗𝚎𝚠𝚜𝚙𝚊𝚙𝚎𝚛

    scatter plot in 3D of Y
versus X1 and X2. A planar
fit is shown with residuals
for each data point.

    Table showing the
coefficients for a linear
regression of Sales versus
TV, radio, and newspaper
advertising all in 1000s of
dollars.
    Interpretation of coefficients

    𝚂𝚊𝚕𝚎𝚜 = β0 + β1 𝚃𝚅 + β2 𝚛𝚊𝚍𝚒𝚘 + β3 𝚗𝚎𝚠𝚜𝚙𝚊𝚙𝚎𝚛
    Table showing the
coefficients for a linear
regression of Sales versus
TV, radio, and newspaper
advertising all in 1000s of
dollars.
    Single regression vs multi-regression

    Sales versus TV advertising scatter plot with
linear fit line PIC

    Sales versus radio advertising scatter plot with
linear fit line PIC

    Sales versus newspaper advertising scatter plot
with linear fit line PIC

    scatter plot in 3D of Y versus X1 and
X2. A planar fit is shown with
residuals for each data point. Table
showing the coefficients for a linear
regression of Sales versus TV, radio,
and newspaper advertising all in
1000s of dollars.

    Correlation matrix Correlation matrix
for TV, radio, newspaper, and sales
all in units of 1000 dollars.

    Coding group work

    Run the section titled “Multiple Linear Regression”

    Section 3 picture picture

    Ch 3.2.2: Questions to ask of your regression
    picture
    Question 1
    picture picture
    Is at least one of the predictors X1,,Xp
    useful in predicting the response?
    Q1: Hypothesis test

    F-statistic:

    F = (𝑇𝑆𝑆 𝑅𝑆𝑆)p 𝑅𝑆𝑆(n p 1) Fp,np1
    The F-statistic for the hypothesis test

    F = (𝑇𝑆𝑆 𝑅𝑆𝑆)p 𝑅𝑆𝑆(n p 1) Fp,np1

    F-distribution for 5 different values of d1, d2
pairs.

    Image from wikipedia, By IkamusumeFan - Own work, CC BY-SA 4.0,

    Do Q1 section in jupyter notebook
    picture
    Q2
    
picture picture
    Do all the predictors help to explain Y , or is only a subset of the predictors useful?
    Q2: A first idea Great, you know at least one variable is important, so which is it?....

    Do Q2 section in jupyter notebook

    Why is this a bad idea?

    Next time

    Screenshot of the course schedule from lectures 1 to 10.