29
The Regression Line Sections 5.1, 5.2 Lecture 13 Robb T. Koether Hampden-Sydney College Thu, Feb 4, 2016 Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 1 / 19

The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

The Regression LineSections 5.1, 5.2

Lecture 13

Robb T. Koether

Hampden-Sydney College

Thu, Feb 4, 2016

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 1 / 19

Page 2: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Outline

1 The Regression Line

2 Review of Straight Lines

3 The Least-Squares Regression Line

4 Example

5 Assignment

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 2 / 19

Page 3: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Outline

1 The Regression Line

2 Review of Straight Lines

3 The Least-Squares Regression Line

4 Example

5 Assignment

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 3 / 19

Page 4: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

The regression line is the line of “best fit.”We will see soon what “best fit” means.In the example of the free-lunch rate vs. the graduation rate, theregression line turns out to be

y = 91.047− 0.494x

where x is the free-lunch rate and y is the graduation rate.

What does that tell us?

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 4 / 19

Page 5: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

The regression line is the line of “best fit.”We will see soon what “best fit” means.In the example of the free-lunch rate vs. the graduation rate, theregression line turns out to be

y = 91.047− 0.494x

where x is the free-lunch rate and y is the graduation rate.What does that tell us?

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 4 / 19

Page 6: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Outline

1 The Regression Line

2 Review of Straight Lines

3 The Least-Squares Regression Line

4 Example

5 Assignment

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 5 / 19

Page 7: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

The Equation of a Line

The equation of a (nonvertical) straight line is of the form

y = a + bx .

The coefficient a is the y -intercept.The coefficient b is the slope.The variable x is the explanatory variable.The variable y is the response variable.

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 6 / 19

Page 8: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Slope and Intercept

The y -intercept is the value of y when x = 0.Normally, but not always, this is well out of the range of interest.The slope tells us how fast y changes as x changes.Specifically, a slope of b means that if x increases by 1, then y willchange by b.

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 7 / 19

Page 9: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Example

ExampleDistrict Free Lunch Grad. Rate District Free Lunch Grad. RateAmelia 41.2 68.9 King and Queen 59.9 64.1Caroline 40.2 62.9 King William 27.9 67.0Charles City 45.8 67.7 Louisa 44.9 80.1Chesterfield 22.5 80.5 New Kent 13.9 77.0Colonial Hgts 25.7 73.0 Petersburg 61.6 54.6Cumberland 55.3 63.9 Powhatan 12.2 89.3Dinwiddie 45.2 71.4 Prince George 30.9 85.0Goochland 23.3 76.3 Richmond 74.0 46.9Hanover 13.7 90.1 Sussex 74.8 59.0Henrico 30.2 81.1 West Point 19.1 82.0Hopewell 63.1 63.4

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 8 / 19

Page 10: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Example

Example (Slope and Intercept)Use the equation

y = 91.047− 0.494x

to predict the graduation rate when the free-lunch rate is20%50%100%44.9% (Louisa)

What does the y -intercept tell us?What does the slope tell us?

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 9 / 19

Page 11: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Example

Example (Slope and Intercept)Use the equation

y = 91.047− 0.494x

to predict the graduation rate when the free-lunch rate is20%50%100%44.9% (Louisa)

What does the y -intercept tell us?

What does the slope tell us?

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 9 / 19

Page 12: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Example

Example (Slope and Intercept)Use the equation

y = 91.047− 0.494x

to predict the graduation rate when the free-lunch rate is20%50%100%44.9% (Louisa)

What does the y -intercept tell us?What does the slope tell us?

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 9 / 19

Page 13: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Outline

1 The Regression Line

2 Review of Straight Lines

3 The Least-Squares Regression Line

4 Example

5 Assignment

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 10 / 19

Page 14: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

The Predicted Response

We use the variable y , read “y hat,” to indicate the predicted yvalue.The variable y is the observed y value.The equation

y = a + bx

allows us to find the predicted value of y for a given value of x .

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 11 / 19

Page 15: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

The Error

It is unlikely that the predicted y will agree with the observed y .The difference is called the error (or the residual).

error = observed response− predicted response= y − y .

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 12 / 19

Page 16: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

The Least-Squares Regression Line

Definition (The Least-Squares Regression Line)The least-squares regression line is the line that makes the sum of thesquared errors as small as possible.

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 13 / 19

Page 17: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Outline

1 The Regression Line

2 Review of Straight Lines

3 The Least-Squares Regression Line

4 Example

5 Assignment

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 14 / 19

Page 18: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Example

Example (Sum of Squared Errors)Consider the data

x y3 405 807 1609 180

16 240The regression line turns out to be

y = 20 + 15x .

Calculate the errors and the sum of the squared errors.Draw the scatterplot and indicate the errors.

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 15 / 19

Page 19: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Example

Example (Sum of Squared Errors)

x y y y − y (y − y)2

3 40

65 −25 625

5 80

95 −15 225

7 160

125 35 1225

9 180

155 25 625

16 240

260 −20 4000 3100

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 16 / 19

Page 20: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Example

Example (Sum of Squared Errors)

x y y y − y (y − y)2

3 40 65

−25 625

5 80 95

−15 225

7 160 125

35 1225

9 180 155

25 625

16 240 260

−20 4000 3100

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 16 / 19

Page 21: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Example

Example (Sum of Squared Errors)

x y y y − y (y − y)2

3 40 65 −25

625

5 80 95 −15

225

7 160 125 35

1225

9 180 155 25

625

16 240 260 −20

4000 3100

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 16 / 19

Page 22: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Example

Example (Sum of Squared Errors)

x y y y − y (y − y)2

3 40 65 −25 6255 80 95 −15 2257 160 125 35 12259 180 155 25 625

16 240 260 −20 400

0 3100

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 16 / 19

Page 23: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Example

Example (Sum of Squared Errors)

x y y y − y (y − y)2

3 40 65 −25 6255 80 95 −15 2257 160 125 35 12259 180 155 25 625

16 240 260 −20 4000 3100

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 16 / 19

Page 24: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Example

Example (Sum of Squared Errors)

0 2 4 6 8 10 12 14 16 180

40

80

120

160

200

240

280

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 17 / 19

Page 25: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Example

Example (Sum of Squared Errors)

0 2 4 6 8 10 12 14 16 180

40

80

120

160

200

240

280

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 17 / 19

Page 26: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Example

Example (Sum of Squared Errors)

0 2 4 6 8 10 12 14 16 180

40

80

120

160

200

240

280

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 17 / 19

Page 27: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Example

Example (Sum of Squared Errors)

0 2 4 6 8 10 12 14 16 180

40

80

120

160

200

240

280

-25

-15

-20

25

35

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 17 / 19

Page 28: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Outline

1 The Regression Line

2 Review of Straight Lines

3 The Least-Squares Regression Line

4 Example

5 Assignment

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 18 / 19

Page 29: The Regression Line Sections 5.1, 5people.hsc.edu/faculty-staff/robbk/math121/lectures... · Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb

Assignment

AssignmentRead Sections 5.1, 5.2, 5.3.Apply Your Knowledge: 1, 2, 4, 5.Check Your Skills: 20, 21, 23, 24, 25, 26.Exercises: 30, 34, 35(a-b), 37, 38.

Robb T. Koether (Hampden-Sydney College) The Regression LineSections 5.1, 5.2 Thu, Feb 4, 2016 19 / 19