linear regression

24
Linear Regression Linear Regression Section 3.3 Section 3.3

Upload: ciaran-wolf

Post on 30-Dec-2015

26 views

Category:

Documents


0 download

DESCRIPTION

Linear Regression. Section 3.3. Warm Up. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Linear Regression

Linear RegressionLinear RegressionLinear RegressionLinear Regression

Section 3.3Section 3.3

Page 2: Linear Regression

Warm Up• In many communities there is a strong

positive correlation between the amount of ice cream sold in a given month and the number of drownings that occur in that month. Does this mean that ice cream causes drowning? If not, can you think of other alternatives for the strong association?

Page 3: Linear Regression

Warm Up #2……• Explain why one would expect to

find a positive correlation between the number of fire engines that respond to a fire and the amount of damage done in the fire.

Page 4: Linear Regression

Regression Line……• If the value of the

correlation coefficient is significant, the next step is to find the equation of the regression line.

• Regression Line –

The data’s line of best fit which is determined by the slope and y-intercept.

Page 5: Linear Regression

Regression Analysis……

• It finds the equation of the line that best describes the relationship between the 2 variables.

• Primary Purpose:

To Make Predictions

*This is a test question.

Page 6: Linear Regression

Prediction Models……

baxyLineara :.

cbxaxyQuadraticb 2:.

)(:. xbaylExponentiac

xaycLogarithmid blog:.

Page 7: Linear Regression

Remember Algebra?......

• The slope intercept form of a line was y = mx + b where m is the slope and b is the y-intercept

• Slope:The change in y over the change in x.

• Y-intercept:where the line crosses the y-axis.

Page 8: Linear Regression

Line of Best Fit……• The equation

used to find the line of best fit is

y = ax + b

• where

“a” = slope and“b” = y-intercept

Page 9: Linear Regression

Computational Formulas……y = ax +

b• To find a: • To find b:

2)(

))((

xx

yyxxa

)( xayb

Page 10: Linear Regression

Example 1……• Find the equation

of the line of best fit.

• Predict the # of sales when 5 ads are sold.

# of ads # of sales

3 7

4 6

2 5

6 10

4 8

Page 11: Linear Regression

Go by the formula……These are the lists you

will need.

x y xx yy ))(( yyxx 2)( xx

Page 12: Linear Regression

First……• Find the mean of

x and the mean of y and write it down.

• Put x’s in L1 – stat calc one var stats L1

• Put y’s in L2 – stat calc one var stats L2

Page 13: Linear Regression

Means of x and y……

Page 14: Linear Regression

Let’s fill in the lists……L1 L2 L3 = L1 - 3.8 L4 = L2 - 7.2 L5 =L3 x L4 L6 = L3 squared

x y x - xbar y - ybar (x-xbar)(y-ybar) (x - xbar) squared

3 7 -0.8 -0.2 0.16 0.64

4 6 0.2 -1.2 -0.24 0.04

2 5 -1.8 -2.2 3.96 3.24

6 10 2.2 2.8 6.16 4.84

4 8 0.2 0.8 0.16 0.04

10.2 8.8

Page 15: Linear Regression

Compute “a”……

16.1159090909.18.8

2.10a

Page 16: Linear Regression

Compute “b”……

8.2)8.3)(159090909.1(2.7 b

Page 17: Linear Regression

Plug into y = ax + b……

• Answer:

y = 1.16x + 2.8

Page 18: Linear Regression

Predict ……• Predict the number of sales when

5 ads are sold.

Y = 1.16(5) + 2.8 = 8.6 = 9 sales

Page 19: Linear Regression

Example 2……• A. Find the equation

of the line of best fit.• B. Predict hours of

exercise if the person is 35 yrs old.

• C. Predict the age if they exercise 9 hours per week.

Age Exercise

18 10

26 5

32 2

38 3

52 1.5

59 1

Page 20: Linear Regression

Find the means……• X-Values: • Y-Values:

Page 21: Linear Regression

The lists……L1 L2 L3 = L1 - 37.5 L4 = L2 - 3.75 L5 =L3 x L4 L6 = L3 squared

x y x - xbar y - ybar (x-xbar)(y-ybar) (x - xbar) squared

18 10 -19.5 6.25 -121.9 380.25

26 5 -11.5 1.25 -14.38 132.25

32 2 -5.5 -1.75 9.625 30.25

38 3 0.5 -0.75 -0.375 0.25

52 1.5 14.5 -2.25 -32.63 210.25

59 1 21.5 -2.75 -59.13 462.25

-218.75 1215.5

Page 22: Linear Regression

Compute “a” and “b”……

18.5.1215

75.218

a 50.10)5.37)(18.(75.3 b

Page 23: Linear Regression

Equation: y = mx + b• Plug into the formula for the

equation of the trend line.

Y = -.18x + 10.50

Page 24: Linear Regression

Predictions……• Find y when x =

35.

• Y = -.18(35) + 10.50

• Y = 4.2 hours

• Find x when y = 9.

• 9 = -.18x + 10.50• 9-10.50 = -.18x• -1.5 = -.18x• X = 8.3• X = 8 years