+ All Categories
Home > Documents > Week 3: Basic regression - 4. How useful is a linear model

Week 3: Basic regression - 4. How useful is a linear model

Date post: 28-Feb-2022
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
15
Week 3: Basic regression 4. How useful is a linear model Stat 140 - 04 Mount Holyoke College Dr. Shan Shan Slides posted at http:// sshanshans.github.io/ stat140
Transcript
Page 1: Week 3: Basic regression - 4. How useful is a linear model

Week 3: Basic regression

4. How useful is a linear model

Stat 140 - 04

Mount Holyoke College

Dr. Shan Shan Slides posted at http://sshanshans.github.io/stat140

Page 2: Week 3: Basic regression - 4. How useful is a linear model

2020 U.S. Election Example

1

Page 3: Week 3: Basic regression - 4. How useful is a linear model

2020 U.S. Election Example

2

Page 4: Week 3: Basic regression - 4. How useful is a linear model

What does the intercept mean here?

Is it useful?

What is R2?

3

Page 5: Week 3: Basic regression - 4. How useful is a linear model

What does the intercept mean here?

Is it useful?

What is R2?

3

Page 6: Week 3: Basic regression - 4. How useful is a linear model

Statistics Exam Example

The two scatterplots below show the relationship between finaland mid-semester exam grades recorded during several years fora Statistics course at a university.

I Final exam the final

I Exam 1 first midterm

I Exam 2 second midterm

4

Page 7: Week 3: Basic regression - 4. How useful is a linear model

Poll question

Which of these models would you prefer to use for predictingsales?

a Exam 1

b Exam 2

5

Page 8: Week 3: Basic regression - 4. How useful is a linear model

Think together

Being as specific and concrete as possible, write down a rule forselecting your preferred model

1. based only on visual characteristics of the plot.

2. based only on a quantitative summary of the data. Youcan describe how you would calculate your numericsummary of the data in a general sense; if you’d like youcan write down a formula.

6

Page 9: Week 3: Basic regression - 4. How useful is a linear model

Variation of residuals

Residuals:

I ei = yi − yi (vertical distance between point and line)I Smaller residuals mean the predictions were better.I The key is to measure the spread of residuals.

7

Page 10: Week 3: Basic regression - 4. How useful is a linear model

Residual standard error

Measure spread of residuals with the standard deviation. We callthis the residual standard error, sRES.

I Exam 1: 4.28

I Exam 2: 3.26

8

Page 11: Week 3: Basic regression - 4. How useful is a linear model

Variation accounted by the model

The variability in the residuals describes how much variationremains after using the model

9

Page 12: Week 3: Basic regression - 4. How useful is a linear model

Variation accounted by the model

Let’s compute the reduction in variation.

s2sales − s2RESs2sales

= 0.61

This number describes the amount of variation in the y-variablethat is explained by the least squares line.

An value of 61% indicates that 61% of the variation in finalexam grades can be accounted for by Exam 1 grades.

10

Page 13: Week 3: Basic regression - 4. How useful is a linear model

More practice

Variation accounted by the model

I Exam 1: 0.61

I Exam 2: 0.73

meaning,

I 61% of the variation in final exam grades can be accountedfor by Exam 1 grades;

I 73% of the variation in final exam grades can be accountedfor by Exam 2 grades

11

Page 14: Week 3: Basic regression - 4. How useful is a linear model

How do we compute the reduction?

Statisticians found the variation accounted by the model can becomputed by R2, the square of correlation.

Square of the correlation coefficient R: between 0 and 1, closerto 1 is better.

R2 describes the amount of variation in the y-variable that isexplained by the least squares line.

12

Page 15: Week 3: Basic regression - 4. How useful is a linear model

Compute R2 from R

linear fit ← lm(Mortality ∼ Calcium, data = mortality water)summary(linear fit)

13


Recommended