Docsity

Simple Linear Regression and Correlation: Lecture 5 by Ramón V. León - Prof. Ramon Leon, Study notes of Statistics

Toggle sidebar
bg1
1
4/21/2008 Lecture 5 - Ramón V. León 1
Unit 5 : Simple Linear
Regression and Correlation
Statistics 201: Introductory Statistics
Ramón V. León
4/21/2008 Lecture 5 - Ramón V. León 2
Introductory Remarks
• Regression analysis is a method for studying the
relationship between two or more numerical variables
• In regression analysis one of the variables is regarded as a
response,outcome or dependent variable
• The other variables are regarded as predictor,
explanatory or independent variables
• An empirical model approximately captures the main
features of the relationship between the response variable
and the key predictor variables
• Sometimes it is not clear which of two variable should be
the response. In this case correlation analysis is used.
• In this unit we consider only two variables
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Simple Linear Regression and Correlation: Lecture 5 by Ramón V. León - Prof. Ramon Leon and more Study notes Statistics in PDF only on Docsity!

4/21/2008 Lecture 5 - Ramón V. León 1

Unit 5 : Simple Linear

Regression and Correlation

Statistics 201: Introductory Statistics

Ramón V. León

4/21/2008 Lecture 5 - Ramón V. León 2

Introductory Remarks

  • Regression analysis is a method for studying the relationship between two or more numerical variables
  • In regression analysis one of the variables is regarded as a response , outcome or dependent variable
  • The other variables are regarded as predictor , explanatory or independent variables
  • An empirical model approximately captures the main features of the relationship between the response variable and the key predictor variables
  • Sometimes it is not clear which of two variable should be the response. In this case correlation analysis is used.
  • In this unit we consider only two variables

4/21/2008 Lecture 5 - Ramón V. León 3

A Probabilistic Model for

Simple Linear Regression

2

Note that the Y i are independent N ( μ i = β 0 +β 1 xi , σ ) r.v.'s

Notice that the predictor variable is regarded as nonrandom because it is assumed to be set by the investigator

Constant variability about the regression line

4/21/2008 Lecture 5 - Ramón V. León 4

Reflections on the Method of Tire

Data Collection: Experimental Design

  • Was one tire or nine used in the experiment? (Read the book!)
  • What effect would this answer have
    • on the experimental error?
    • on our ability to generalize to all tires of this brand?
  • Was the data collected on one or several cars? Does it matter?
  • Was the data collected in random order or in the order given? Does it matter?
  • Is there a possible confounding problem?

Mileage Depth 0 394. 4 329. 8 291 12 255. 16 229. 20 204. 24 179 28 163. 32 150.

•Mileage in 1000 miles •Depth in mils

4/21/2008 Lecture 5 - Ramón V. León 7

Least Squares Line Fit

y = β +β x

4/21/2008 Lecture 5 - Ramón V. León 8

Illustration: Least Squares Line Fit

The least squares line fit is the line that minimizes the sum of the squares of the lengths of the vertical segments

4/21/2008 Lecture 5 - Ramón V. León 9

Mathematics of Least Squares

[ ]

0 1

2 0 1 1

0 1

0 1

Find the line, i.e., values of and that minimizes the
sum of the squared deviations:
How?
Solve for values of and for which
Q Q
0 and 0

n i i i

Q y x

=

∑

4/21/2008 Lecture 5 - Ramón V. León 10

Predict Mean Grove Depth for a Given

Mileage

0 1

For 25 (25,000 miles) the predicted y:

ˆ ˆ^ ˆ(25) 360.64 7.281 25 178.62 mils.

x

y β β

= + = − × =

Add a row to the table and leave the y value blank.

4/21/2008 Lecture 5 - Ramón V. León 13

Estimation of σ^2

( ) (^) ( )

2 2 2 0 1 (^2 1 1 )

ˆ ˆ^ ˆ

n n n i i i i i i i i

e y y y x

s

n n n

β β = = =

− − ⎡^ + ⎤

∑ ∑ ∑

2 s

s

This estimate has n-2 degrees of freedom because two unknown parameters are estimated.

4/21/2008 Lecture 5 - Ramón V. León 14

Statistical Inference for β 0 and β 1

[ ]

0 0 1 1 0 1 (^0 0 2 1 ) 0 1

1 2, 2 1 7,0.

0 2, 2 0 7,

ˆ ˆ ˆ (0,1) and^ ˆ (0,1) ( ) ( ) ˆ ˆ ˆ and ˆ ( ) ( )

ˆ (^) ( ˆ) 7.28 0. 7.28 2.365 0.614 8.733, 5. ˆ (^) ( ˆ) 360.

n n

n

n

N N SD SD

t t SE SE

t SE t

t SE t

α

α

β β β β β β β β β β β β

β β

β β

− −

−

−

− −

− −

± = − ± × = − ± × = − − ± = ±

100(1 - α)% CI :

∼ ∼

∼ ∼

0.025 ×^ 11.

  1. Right click on the Parameter Estimate area
    1. Select

4/21/2008 Lecture 5 - Ramón V. León 15

Test of Hypothesis for β 0 and β 1

0 1 1 1

1 1 0 2, 2 1 1

: 0 vs. : 0 ˆ 0 ˆ Reject at level if |t|= ( ˆ^ ) ( ˆ) n

H H

H t SE SE α

−

1 7,. 1

( ˆ^ ).
t t
SE

Tire example:

Strong evidence that mileage affects tread depth. (Two-sided p-value)

4/21/2008 Lecture 5 - Ramón V. León 16

Prediction of a Future y or Its Mean

For a fixed value of x*, are we trying to predict -the average value of y? -the value of a future observation of y?

Example:

  • Do I want to predict the average selling price of all 4,000 square feet houses in my neighborhood.
  • Or do I want to predict the particular future selling price of my 4,000 square feet house?

Which prediction is subject to the most error?

4/21/2008 Lecture 5 - Ramón V. León 19

JMP: Prediction of a Future Value of y

100

150

200

250

300

350

400

Grove Depth (in mils)

-10 0 10 20 30 40 Mileage (in 1000 Miles

4/21/2008 Lecture 5 - Ramón V. León 20

Formulas for Confidence and Prediction Intervals

Prediction Interval of Chapter 7:

1

n xx i i

S x x

= (^) ∑ −

4/21/2008 Lecture 5 - Ramón V. León 21

Confidence and Prediction Intervals with JMP

Using the Fit Model Platform not the Fit Y by X platform

4/21/2008 Lecture 5 - Ramón V. León 22

CI for Mean for μ*

4/21/2008 Lecture 5 - Ramón V. León 25

Residuals

The residuals are the differences between the observed value of y and the predicted value of y

0 1 y ˆ^ = βˆ + βˆ(32) = 360.64 − 7.281 × 32 =127.65 mils

4/21/2008 Lecture 5 - Ramón V. León 26

Regression Diagnostics

The residuals ˆ can be viewed as the "left over" after the model is fitted. If the model is correct , then the can be viewed as the "estimates" of the random errors '. As such, the residua

i i i

i i

e y y

e ε s

ls are vital for checking the model assumptions.

Residual plots

If the model is correct the residuals should have no structure, that is, they should look random on their plots.

4/21/2008 Lecture 5 - Ramón V. León 27

Basic Principle Underlying Residual Plots

If the assumed model is correct then the

residuals should be randomly scattered around

0 and should show no obvious systematic

pattern.

4/21/2008 Lecture 5 - Ramón V. León 28

Residuals

in JMP

In Fit Y by X platform: In Fit Model platform:

Red triangle menu next to Linear Fit.

4/21/2008 Lecture 5 - Ramón V. León 31

Tread Wear Quadratic Model

4/21/2008 Lecture 5 - Ramón V. León 32

Residuals for

Quadratic Model

Residuals have a random pattern

Left plot can also be obtained using the Plot Residuals option

The Fit Y by X platform was used to get these plots

4/21/2008 Lecture 5 - Ramón V. León 33

Tread Wear Quadratic Model

R^2 was .95261 for model linear in x

4/21/2008 Lecture 5 - Ramón V. León 34

Checking for Constant Variance:

Plot of Predicted vs. Residual

If assumption is incorrect,

often ( ) is some function of ( )

Var Y E Y = μ

4/21/2008 Lecture 5 - Ramón V. León 37

Tire Tread Wear vs. Mileage:

Exponential Model

log log

x

y e

y x

β α α β

−

4/21/2008 Lecture 5 - Ramón V. León 38

Tire Tread Wear vs. Mileage: Exponential Model

5.93 .0298.

MILES MILES

WEAR e e e

− −

⇒ = × =