Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics,...

19
Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics , Fourth Edition. Starnes, Yates, Moore

Transcript of Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics,...

Page 1: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

Least-Squares Regression:Linear Regression

Section 3.2

Reference Text:

The Practice of Statistics, Fourth Edition.

Starnes, Yates, Moore

Page 2: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

Warm up/ quiz

• Draw a quick sketch of three scatterplots:– Draw a plot with r ≈ .9– Draw a plot with r ≈ -.5– Draw a plot with r ≈ 0

Page 3: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

Today’s Objective

• Regression line, introducing “y-hat”– Predicted value – Slope– Y-intercept

• Extrapolation• Residuals • Least-squares Regression Line

– How to use your calculator effectively for time

y a bx

Page 4: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

Your Poster!

• Take a look at your poster: Do you think you could draw a straight line that would go straight through the middle where you have ½ your points above and ½ your points below?– Calculate your line:

• m = y2-y1 / x2-x1 • Point slope form: y – y1 = m ( x - x1)

• In math-land this is known as a “line of best fit”

Page 5: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

Regression Line

• In statistics, this is called a regression line!

• A line that describes how a response variables y changes as an explanatory variable x changes. We often use a regression line to predict the value of y for a given value of x.

Page 6: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

Formulas for Regression Line• The RL is linear, so it follows the form y = mx + b

– In Statistics, we say

– In this context, is called the predicted value– WARNING: we are entering “predicting” statistics,

using the “ ” symbol is very important – [story about AP training]

– So is the predicted value– And ‘a’ is the y-intercept, the predicted value of y

when x=0– And ‘b’ is the slope

y

y a bx

y

y

y a bx

Page 7: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

Equation of Regression

Page 8: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

The Meaning of Slope• In a simple algebraic function like y = 2x + 17,

what is the real meaning of the slope?– For every increase in x of 1 unit, y increases by 2

• In the function y = 2x + 17 what is the meaning of the y intercept?– It is the value y takes on when x = 0

• In statistics if the regression line is = 3.505 - .00344x– What is the slope?– What is the y-intercept?

y

Page 9: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

Context

Page 10: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

ExtrapolationTake a look at your poster!

• Take a look at the range of your data.

• Your line is linear- so it does on and on even past your data points

• Predict an output value when you input a large number outside your data range

• Put it into context: examples?

• This is whats known as extrapolating!

Page 11: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

Extrapolation

• Is the use of a regression line for prediction outside the interval of values of the explanatory variable x used to obtain the line. Such predictions are often not accurate.

• “Just because your line behaves the way it does within the confines, does not mean its gets all squirrely later on! We cant predict the behavior of data to extremes.”

Page 12: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

Example

• Some data were collected on the weight of a male white laboratory rat for the first 25 weeks after its birth. A scatterplot of the weight (in grams) and time since birth (in weeks) shows a fairly strong, positive relationship. The linear regression equation weight = 100 + 40(time) models the data fairly well.

• 1) What is the slope of the regression line? Explain what it means in context

• 2) what’s the y intercept? Explain in context• 3) predict the rat’s weight after 16 weeks, show your

work• 4) Should you use the line to predict the rat’s weight at

age 2 years?

Page 13: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

Residuals

• Look at your graph, how far away are your points from your graph?

• Residuals is the difference between an observed value of the response variable and the value predicted by the regression line.

• Residual = observed y – predicted y

Page 14: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

Finding a residual

• Find and interpret the residual for the hiker who weighed 187 pounds.

• Regression line: – Pack weight = 16.3 + .0980( 187) = 33.28 lbs– His actual pack weight was 30 pounds.– Residual = observed – predicted– Residual = 30 – 33.28 = -3.28– The (-) sign tells us that the observed is below the

predicted by 3.28 pounds.– Negative: Below predicted, Positive: above Predicted

Page 15: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

Least-Squares Regression Line

• We’ve been using the least-squares regression line this whole time!

• We will talk about where the LSRL comes from next class!

• But for now…lets learn how to use our tool to make our Stats crunching FAST!

y a bx

Page 16: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

LSRL TI-83/ TI-89

• TI-83– Put your data in L1, and L2– STAT> CALC>#8 >Enter

• Did you know your TI-83 will default to using L1 and L2 as our lists, so as long as you put your data in L1 and L2, you don’t have to tell it!

• TI-89– Statistics/List Editor> F4 (CALC)>#3> #1– Practice next slide!

Page 17: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

Practice with your TI Calculator

• You Should get: = 16.3 + .0908x

Body Weight (lbs)

120 187 109 103 131 165 158 116

Backpack Weight (lbs)

26 30 26 24 29 35 31 28

y

Page 18: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

Today’s Objective

• Regression line, introducing “y-hat”– Predicted value – Slope– Y-intercept

• Extrapolation• Residuals • Least-squares Regression Line

– How to use your calculator effectively for time

y a bx

Page 19: Least-Squares Regression: Linear Regression Section 3.2 Reference Text: The Practice of Statistics, Fourth Edition. Starnes, Yates, Moore.

Homework

Worksheet