simple linear regression 1. the least squares procedure 2. inference for least squares lines
DESCRIPTION
Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines . Chapter 12. Introduction. We will examine the relationship between quantitative variables x and y via a mathematical equation. The motivation for using the technique: - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/1.jpg)
1
Simple Linear Regression1. the least squares procedure
2. inference for least squares lines
Chapter 12
![Page 2: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/2.jpg)
2
Introduction
• We will examine the relationship between quantitative variables x and y via a mathematical equation.
• The motivation for using the technique:– Forecast the value of a resposne variable (y) from
the value of explanatory variables (x1, x2,…xk.).– Analyze the specific relationship between the
explanatory variable and the dependent variable.
![Page 3: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/3.jpg)
3
House size
HouseCost
Most lots sell for $25,000
Building a house costs about
$75 per square foot.
House cost = 25000 + 75(Size)
The Model
The model has a deterministic and a probabilistic component
![Page 4: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/4.jpg)
4
House cost = 25000 + 75(Size)
House size
HouseCost
Most lots sell for $25,000
+ e
However, house costs vary even among same size houses!
The Model
Since cost behave unpredictably, we add a random component.
![Page 5: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/5.jpg)
5
The Model
• The first order linear model
y = response variablex = explanatory variableb0 = y-interceptb1 = slope of the linee = error variable
e+b+b xy 10
x
y
b0Run
Rise b1 = Rise/Run
b0 and b1 are unknown populationparameters, therefore are estimated from the data.
![Page 6: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/6.jpg)
6
Estimating the Coefficients
• The estimates are determined by – drawing a sample from the population of interest,– calculating sample statistics.– producing a straight line that cuts into the data.
wwww w w w w
w
w ww
w ww
Question: What should be considered a good line?
x
y
![Page 7: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/7.jpg)
7
The Least Squares (Regression) Line
A good line is one that minimizes the sum of squared differences between the points and the line.
![Page 8: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/8.jpg)
8
The Least Squares (Regression) Line
3
3
ww
ww
41
1
4
(1,2)
2
2
(2,4)
(3,1.5)
Sum of squared differences = (2 - 1)2 + (4 - 2)2 +(1.5 - 3)2 +
(4,3.2)
(3.2 - 4)2 = 6.89Sum of squared differences = (2 -2.5)2 + (4 - 2.5)2 + (1.5 - 2.5)2 + (3.2 - 2.5)2 = 3.99
2.5
Let us compare two linesThe second line is horizontal
The smaller the sum of squared differencesthe better the fit of the line to the data.
![Page 9: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/9.jpg)
9
The Estimated CoefficientsTo calculate the estimates of the slope and intercept of the least squares line , use the formulas:
1
0 1
2
1
2
1
correlation coefficient
( )
1
( )
1
y
x
n
ii
y
n
ii
x
sb r
sb y b xr
y ys
n
x xs
n
The least squares prediction equation that estimates the mean value of y for a particular value of x is:
0 1y b b x +
![Page 10: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/10.jpg)
10
• Example:– A car dealer wants to find
the relationship between the odometer reading and the selling price of used cars.
– A random sample of 100 cars is selected, and the data recorded.
– Find the regression line.
Car Odometer Price1 37400 146002 44800 141003 45800 140004 30900 156005 31700 156006 34000 14700
. . .
. . .
. . .
Independent variable x
Dependent variable y
The Simple Linear Regression Line
![Page 11: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/11.jpg)
11
The Simple Linear Regression Line• Solution
– Solving by hand: Calculate a number of statistics36,011;
14,841;
x
y
6596.125
547.74
x
y
s
s
where n = 100.
1
0 1
547.740.81517 .067696596.125
14,841 ( .06769)(36,011) 17, 286.15
y
x
sb r
sb y b x
0 1ˆ 17, 286.15 .06769y b b x x +
0.80517r
![Page 12: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/12.jpg)
12
• Solution – continued– Using the computer
1. Scatterplot2. Trend function3. Data tab > Data Analysis > Regression
The Simple Linear Regression Line
![Page 13: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/13.jpg)
Regression StatisticsMultiple R 0.805167979R Square 0.648295475
Adjusted R Square 0.644706653Standard Error 326.4886258Observations 100
ANOVA df SS MS F Significance F
Regression 1 19255607.37 19255607.37 180.643 5.75078E-24Residual 98 10446292.63 106594.8228Total 99 29701900
Coefficients Standard Error t Stat P-value Lower 95% Upper 95%Intercept 17248.72734 182.0925742 94.72504534 3.57E-98 16887.37056 17610.084Odometer -0.06686089 0.004974639 -13.44034928 5.75E-24 -0.076732895 -0.0569889
13
ˆ 17, 248.73 .06686y x
The Simple Linear Regression Line
![Page 14: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/14.jpg)
ˆ 17, 248.73 .06686y x
14
This is the slope of the line.For each additional mile on the odometer,the price decreases by an average of $0.0669
Odometer Line Fit Plot
13000
14000
15000
16000
Odometer
Pric
e
Interpreting the Linear Regression -Equation
The intercept is b0 = $17248.73.
0 No data
Do not interpret the intercept as the “Price of cars that have not been driven”
17248.73
![Page 15: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/15.jpg)
15
Error Variable: Required Conditions
• The error e is a critical part of the regression model.• Four requirements involving the distribution of e must
be satisfied.– The probability distribution of e is normal.– The mean of e is zero: E(e) = 0.– The standard deviation of e is se for all values of x.– The set of errors associated with different values of y are
all independent.
![Page 16: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/16.jpg)
16
The Normality of e
From the first three assumptions we have:y is normally distributed with meanE(y) = b0 + b1x, and a constant standard deviation se
m3
b0 + b1x1
b0 + b1x2
b0 + b1x3
E(y|x2)
E(y|x3)
x1 x2 x3
m1
E(y|x1)
m2
The standard deviation remains constant,
but the mean value changes with x
![Page 17: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/17.jpg)
17
Assessing the Model
• The least squares method will produces a regression line whether or not there is a linear relationship between x and y.
• Consequently, it is important to assess how well the linear model fits the data.
• Several methods are used to assess the model. All are based on the sum of squares for errors, SSE.
![Page 18: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/18.jpg)
18
– This is the sum of differences between the points and the regression line.
– It can serve as a measure of how well the line fits the data. SSE is defined by
.)yy(SSEn
1i
2ii
Sum of Squares for Errors
20 1i i i iSSE y b y b x y
– A shortcut formula
![Page 19: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/19.jpg)
19
– The mean error is equal to zero.– If se is small the errors tend to be close to zero
(close to the mean error). Then, the model fits the data well.
– Therefore, we can, use se as a measure of the suitability of using a linear model.
– An estimator of se is given by se
2
tan
nSSEs
EstimateofErrordardS
e
Standard Error of Estimate
![Page 20: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/20.jpg)
20
• Example:– Calculate the standard error of estimate for the previous
example and describe what it tells you about the model fit.• Solution
10,446,293
10,446,293 326.492 98
SSE
SSEsne
It is hard to assess the model based on se even when compared with the mean value of y.
326.49 14,841s ye
Standard Error of Estimate,Example
![Page 21: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/21.jpg)
21
q
q
q
q
q
qq qq
q
q
q
Testing the slope– When no linear relationship exists between two
variables, the regression line should be horizontal.
q
q
q
qqq
q
q
qqq
q
q
qqq
q
q
qqq
q
q
q
qq q
q
q
q
q
q
q
qq qq
q
q
q
q
q
qq q
q
q
q
q
q
qqq
q
q
q
Different inputs (x) yielddifferent outputs (y).
No linear relationship.Different inputs (x) yieldthe same output (y).
The slope is not equal to zero The slope is equal to zero
Linear relationship.Linear relationship.Linear relationship.Linear relationship.
![Page 22: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/22.jpg)
22
• We can draw inference about b1 from b1 by testingH0: b1 = 0H1: b1 = 0 (or < 0,or > 0)– The test statistic is
– If the error variable is normally distributed, the statistic is Student t distribution with d.f. = n-2.
1b
11
sb
tb
The standard error of b1.
1 1bx
ss
n se
where
Testing the Slope
![Page 23: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/23.jpg)
23
• Example– Test to determine whether there is enough evidence
to infer that there is a linear relationship between the car auction price and the odometer reading for all three-year-old Tauruses in the previous example . Use a = 5%.
Testing the Slope,Example
![Page 24: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/24.jpg)
24
• Solving by hand– To compute “t” we need the values of b1 and sb1.
– The rejection region is t > t.025 or t < -t.025 with n = n-2 = 98, t.025
= 1.9845
1
1
1
1 1
.06686326.49 .004975
1 99 6596.125
06686 0 13.44004975
bx
b
bssn s
b .t .s
e
b
Testing the Slope,Example
![Page 25: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/25.jpg)
Odometer Price37400 1460044800 14100 Regression Statistics45800 14000 Multiple R 0.80516797930900 15600 R Square 0.648295475
31700 15600Adjusted R Square 0.644706653
34000 14700Standard Error 326.4886258
45900 14500Observations 100
19100 1570040100 15100 ANOVA40200 14800 df SS MS F Significance F
32400 15200 Regression 1 19255607.37 19255607.4 180.643 5.75078E-2443500 14700 Residual 98 10446292.63 106594.82332700 15600 Total 99 29701900 34500 15600
37700 14600 Coefficients Standard Error t Stat P-value Lower 95% Upper 95%41400 14600 Intercept 17248.72734 182.0925742 94.7250453 3.57E-98 16887.37056 17610.0824500 15700 Odometer -0.066860885 0.004974639 -13.4403493 5.75E-24 -0.076732895 -0.0569935800 1500048600 1470024200 15400
25
• Using the computer
There is overwhelming evidence to inferthat the odometer reading affects the auction selling price.
Testing the Slope (Example)
![Page 26: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/26.jpg)
Coefficient of determination
26
Reduction in prediction error when use x:TSS-SSE = SSR
10
2 2
1 1
2
1
Case I: Case II:
ˆignore : use to predict use : use
errors: (obs. pred.) errors: (obs. pred.)
ˆ ( ) = (
n n
i i
n
i ii
x y y x y b b x
y y y
+
2
1
)
n
ii
y
TSS SSE
![Page 27: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/27.jpg)
Coefficient of determination
27
Reduction in prediction error when use x:TSS-SSE = SSR or TSS = SSR + SSE
2
212 2
Proportional reduction in prediction error when use :
( )( )1 algebra =
n
i ii
x y
x
x x y yTSS SSE SSE rTSS TSS s s
Overall variability in yTSS
The regression modelSSR
Remains, in part, unexplainedThe error
SSE
Explained in part by
![Page 28: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/28.jpg)
28
Coefficient of determination: graphically
x1 x2
y1
y2
y
Two data points (x1,y1) and (x2,y2) of a certain sample are shown.
+ 22
21 )yy()yy( 2
22
1 )yy()yy( + 222
211 )yy()yy( ++
Total variation in y = Variation explained by the regression line
+ Unexplained variation (error)
Variation in y = SSR + SSE (TSS)
![Page 29: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/29.jpg)
29
Coefficient of determination• R2 (=r2 ) measures the proportion of the variation
in y that is explained by the variation in x.
2 1 SSE TSS SSE SSRRTSS TSS TSS
• r2 takes on any value between zero and one (-1r 1).r2 = 1: Perfect match between the line and the data points.r2 = 0: There are no linear relationship between x and y.
![Page 30: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/30.jpg)
30
• Example– Find the coefficient of determination for the used car
price –odometer example.what does this statistic tell you about the model?
• Solution– Solving by hand;
2 2( .80517) .6483r
Coefficient of determination,Example
![Page 31: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/31.jpg)
31
– Using the computer From the regression output we have
Coefficient of determination
Regression StatisticsMultiple R 0.805167979R Square 0.648295475Adjusted R Square 0.644706653Standard Error 326.4886258Observations 100
ANOVA df SS MS F Significance F
Regression 1 19255607.37 19255607.37 180.643 5.75078E-24Residual 98 10446292.63 106594.8228Total 99 29701900
Coefficients Standard Error t Stat P-valueIntercept 17248.72734 182.0925742 94.72504534 3.57E-98Odometer -0.06686089 0.004974639 -13.44034928 5.75E-24
64.8% of the variation in the auctionselling price is explained by the variation in odometer reading. Therest (35.2%) remains unexplained bythis model.
![Page 32: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/32.jpg)
32
• If we are satisfied with how well the model fits the data, we can use it to predict the values of y.
• To make a prediction we use– Point prediction, and– Interval prediction
Using the Regression Equation
• Before using the regression model, we need to assess how well it fits the data.
![Page 33: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/33.jpg)
33
Point Prediction• Example
– Predict the selling price of a three-year-old Taurus with 40,000 miles on the odometer.
– It is predicted that a 40,000 miles car would sell for $14,574.
– How close is this prediction to the real price?
ˆ 17248.73 .06686 17248.73 .066686(40,000) 14,574y x A point prediction
![Page 34: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/34.jpg)
34
Interval Estimates• Two intervals can be used to discover how closely the
predicted value will match the true value of y.– Prediction interval – predicts y for a given value of x,– Confidence interval – estimates the average y for a given x.
– The confidence interval
– The prediction interval2
2 2 22 1ˆ ( )( ) sy t SE b x x s
ne
a n e + +
22 2
2 1ˆ ( )( ) sy t SE b x xne
a n +
![Page 35: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/35.jpg)
35
Interval Estimates,Example
• Example - continued – Provide an interval estimate for the bidding price on
a Ford Taurus with 40,000 miles on the odometer.– Two types of predictions are required:
• A prediction for a specific car• An estimate for the average price per car
![Page 36: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/36.jpg)
36
Interval Estimates,Example
• Solution– A prediction interval provides the price estimate for a
single car:
22 2 2326.4914,574 1.9845 (.004975) (40,000 36,011) 326.49 14,574 652
100 + +
t.025,98
22 2 2
2 1ˆ ( )( ) sy t SE b x x sne
a n e + +
![Page 37: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/37.jpg)
37
• Solution – continued– A confidence interval provides the estimate of the
mean price per car for a Ford Taurus with 40,000 miles reading on the odometer.
• The confidence interval (95%) =
Interval Estimates,Example
22 2
2 1ˆ ( )( ) sy t SE b x x
ne
a n +
22 2 326.4914,574 1.9845 (.004975) (40,000 36,011) 14,574 76
100 +
![Page 38: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/38.jpg)
38
– As x moves away from x the interval becomes longer. That is, the shortest interval is found at x.
22 2
2 1ˆ ( ) ( ) sy t SE b x xne
a n +
x
0 1y b b xn +
The effect of the given x on the length of the interval
![Page 39: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/39.jpg)
22 2
2 1ˆ ( )(1) sy t SE bne
a +
39
x1x)1x( 1x)1x( +
0 1y b b xn +
ˆ( 1)y x xn
ˆ( 1)y x xn +
1x +1x
– As x moves away from x the interval becomes longer. That is, the shortest interval is found at x.
The effect of the given x on the length of the interval
22 2
2 1ˆ ( ) ( ) sy t SE b x xne
a n +
![Page 40: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/40.jpg)
40
x
– As x moves away from x the interval becomes longer. That is, the shortest interval is found at x.
0 1y b b xn +
2x)2x( 2x)2x( +
2x 2x +
The effect of the given x on the length of the interval
22 2
2 1ˆ ( ) ( ) sy t SE b x xne
a n +
22 2
2 1ˆ ( )(1) sy t SE bne
a +
22 2
2 1ˆ ( )(2) sy t SE bne
a +
![Page 41: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/41.jpg)
41
Regression Diagnostics - I
• The three conditions required for the validity of the regression analysis are:– the error variable is normally distributed.– the error variance is constant for all values of x.– The errors are independent of each other.
• How can we diagnose violations of these conditions?
![Page 42: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/42.jpg)
42
Residual Analysis• Examining the residuals (or standardized
residuals), help detect violations of the required conditions.
• Example – continued:– Nonnormality.
• Use Excel to obtain the standardized residual histogram.• Examine the histogram and look for a bell shaped.
diagram with a mean close to zero.
![Page 43: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/43.jpg)
43
For each residual we calculate the standard deviation as follows:
2x
2i
i
ir
s)1n()xx(
n1
h
whereh1ssi
+
e
A Partial list ofStandard residuals
ObservationPredicted Price Residuals Standard Residuals1 14736.91 -100.91 -0.332 14277.65 -155.65 -0.523 14210.66 -194.66 -0.654 15143.59 446.41 1.485 15091.05 476.95 1.58
Standardized residual ‘i’ =Residual ‘i’
Standard deviation
Residual Analysis
![Page 44: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/44.jpg)
44
Standardized residuals
0
10
20
30
40
-2 -1 0 1 2 More
It seems the residual are normally distributed with mean zero
Residual Analysis
![Page 45: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/45.jpg)
45
Heteroscedasticity• When the requirement of a constant variance is violated we have
a condition of heteroscedasticity.• Diagnose heteroscedasticity by plotting the residual against the
predicted y.
+ + ++
+ ++
++
+
+
+
+
+
+
+
+
+
+
++
+
+
+
The spread increases with y
y
Residualy
+
+++
+
++
+
++
+
+++
+
+
+
+
+
++
+
+
![Page 46: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/46.jpg)
46
Homoscedasticity• When the requirement of a constant variance is not
violated we have a condition of homoscedasticity.• Example - continued
-1000
-500
0
500
1000
13500 14000 14500 15000 15500 16000
Predicted Price
Resi
dual
s
![Page 47: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/47.jpg)
47
Non Independence of Error Variables– A time series is constituted if data were collected
over time.– Examining the residuals over time, no pattern should
be observed if the errors are independent.– When a pattern is detected, the errors are said to be
autocorrelated.– Autocorrelation can be detected by graphing the
residuals against time.
![Page 48: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/48.jpg)
48
Patterns in the appearance of the residuals over time indicates that autocorrelation exists.
+
+++ +
++
++ + +
++ + +
++ + +
+
+
+
+
+
+Time
Residual Residual
Time+
+
+
Note the runs of positive residuals,replaced by runs of negative residuals
Note the oscillating behavior of the residuals around zero.
0 0
Non Independence of Error Variables
![Page 49: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/49.jpg)
49
Outliers• An outlier is an observation that is unusually small or large.• Several possibilities need to be investigated when an outlier
is observed:– There was an error in recording the value.– The point does not belong in the sample.– The observation is valid.
• Identify outliers from the scatter diagram.• It is customary to suspect an observation is an outlier if its |
standard residual| > 2
![Page 50: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/50.jpg)
50
+
+
+
++ +
+ + ++
++
+
+
+
+
+
The outlier causes a shift in the regression line
… but, some outliers may be very influential
++++++++++
An outlier An influential observation
![Page 51: Simple Linear Regression 1. the least squares procedure 2. inference for least squares lines](https://reader035.vdocument.in/reader035/viewer/2022062315/568166b0550346895ddaac23/html5/thumbnails/51.jpg)
51
Procedure for Regression Diagnostics• Develop a model that has a theoretical basis.• Gather data for the two variables in the model.• Draw the scatter diagram to determine whether a linear model
appears to be appropriate.• Determine the regression equation.• Check the required conditions for the errors.• Check the existence of outliers and influential observations• Assess the model fit.• If the model fits the data, use the regression equation.