Docsity

Regression Diagnostics: Leverage, Influence, and Outliers in Statistical Inference, Study notes of Statistics

Partial preview of the text

Download Regression Diagnostics: Leverage, Influence, and Outliers in Statistical Inference and more Study notes Statistics in PDF only on Docsity!

Statistics 431:

Statistical Inference

Lecture 18: More regression diagnostics;

polynomial regression

Leverage, influence, outliers

  • (^) Leverage points are observations ( xi , yi ) with xi far from x ¯, the center of the

observed predictor values.

  • (^) A leverage point often strongly affects the slope of the estimated regression

line, βˆ 1 : because such a point is far from x ¯, the “balance point” of the line,

its y value has a lot of leverage to move the line up or down.

  • (^) A leverage point which does in fact strongly affect the regression is called

an influence point. (Some authors treat these terms as synonymous,

however.)

  • (^) When high-leverage points exist, it is often desirable to delete them from

the fit, and then note that the regression applies only over the reduced

range of observed predictor values.

  • (^) Alternatively, a transformation of the predictor may reduce the effect of

high-leverage points.

  • (^) An outlier is a point whose y coordinate is far vertically from the data cloud,

or from the estimated regression line.

  • (^) Outliers often strongly affect the estimated intercept βˆ 0. If the outlier also

has some leverage, it could be an influence point as well.

  • 100 0 100 200 300 400 500 600 700 HC

Linear Fit

Mortality = 944. 9 – 0. 121 HC

Summary of Fit RSquare 0. 032 Root Mean Square Error 61. 75 Mean of Response 940. 3 Observations 60 Analysis of Variance Source DF Sum of Squares Mean Square F Ratio Model 1 7256 7256 1. 903 Error 58 2. 2 e 5 3813 Prob>F C Total 59 2. 3 e 5 0. 173 Parameter Estimates Term Estimate Std Error t Ratio Prob>|t| Intercept 944. 9 8. 631 109. 5 <. 000 HC - 0. 12 0. 087 - 1. 38 0. 173

  • (^) Here is the original fit, together with a fit done after removing the two high

leverage points.The following plot shows both the original fit and the fit with the two high leverage

points removed. (Which line corresponds to which fit?) Mortality By HC

M
o
r
t
a
li
t
y
  • 100 0 100 200 300 400 500 600 700
HC

Here are the tables from the fit with the two high leverage points removed. You can see that these are fairly influential since the slope has changed from – 0. 121 to – 0. 063 : 4

Example: Philadelphia crime rates

  • (^) The data on Philadelphia-area crime rates and housing prices provides an

extreme example of a high-influence point. This point was omitted from the

previous data analysis.

  • (^) Here is a plot of the full data set; the influence point is for Center City. Our data on Philadelphia area Crime Rates and House Prices provides an extreme example of a high-leverage, high-influence point. This point has been omitted from our previous analyses. Here is a plot of the full data set. The offending point is for Center City Philadelphia (?). Bivariate Fit of Hs Prc ($ 10 , 000 ) By Crime Rate 0 10 20 30 40 50 H s^ Pr c^ ($ 10 ,^0 00 ) 0 50 100 150 200 250 300 350 400 Crime Rate Shown on the plot is the regression line for all the data and the regression line for the data with Center City Philadelphia removed. (Which line is which?) Note how strongly influential CC Philadelphia is. (Considering how crime rates are calculated, it’s not surprising that CC Philadelphia is such a high leverage point. But we wouldn’t know that it would be so influential until after the data are gathered and analyzed.) It seems quite reasonable to analyze the data without CCPhiladelphia, as we have already done in our earlier analyses. The results then apply to Hs Prc ¥ Crime Rate for non center city areas.
  • (^) It seems reasonable to analyze the data without center city, as we did

before – the results then apply to housing prices and crime rates for

communities which are not in or near center city.

Example: killer air

  • (^) For the mortality data, we might imagine the two influence points are

important for the goals of the analysis, so we don’t want to exclude them.

  • (^) A log transformation of hydrocarbon level will diminish their influence. (I‘ve lost the original data that identified the cities, but I think they were Phoenix and Los Angeles.) It seems better to transform the x-axis to reduce the leverage of these points. So we transform to Log 10 (HC). (Loge would work just as well.) The resulting equation will linearly relate Mortality to Log(HC), and this might be a scientifically a more plausible relation than would the original linear relation to HC assumed to hold in the first analysis. Note that the correlation between Mortality and LogHC is positive (but not statistically significant), whereas that between Mortality and HC was negative (but not statistically significant). Mortality By LogHC M o rt a li t y 750 800 850 900 950 1000 1050 1100 1150
        1. 5 1. 0 1. 5 2. 0 2. 5 3. 0 LogHC Linear Fit Mortality = 918. 5 + 18. 30 LogHC Summary of Fit RSquare 0. 023 Root Mean Square Error 62. 04 Observations 60
  • (^) Note the estimated slope has changed from negative to positive, but in both

cases it is not statistically significant.

Polynomial regression

  • (^) Sometimes, no simple transformation of predictor or response will give a

satisfactory linear relationship.

  • (^) In such cases, it may make sense to relax the linearity assumption and

allow curvature in the regression function μ( x ) = E [ Y | X = x ].

  • (^) One easy-to-treat class of nonlinear regression functions is the polynomials

μ( x ) = β 0 + β 1 x + β 2 x

2

+... + β k x

k

  • (^) The “ideal polynomial model” is exactly the same as the ideal linear model,

except for the form of the regression function:

( Yi | X = xi ) ∼ N (β 0 + β 1 xi + β 2 x

2

i +^...^ +^ β k^ x

k

i , σ^

2

with the Yi ’s independent.

  • (^) Notice we are hanging on to the equal-variances assumption.

Least-squares fitting of polynomials

  • (^) As before, we are going to estimate regression coefficients by minimizing

the sum of squared residuals.

  • (^) Now we have ( k + 1 ) coefficients instead of two, and the mechanics of

calculating residuals are different (but the idea is the same):

S ( βˆ 0 ,... , βˆ k ) =

n

i = 1

e

2

i =

n

i = 1

( yi − ˆ yi )

2

n

i = 1

( yi − ( βˆ 0 + ˆβ 1 x +... + ˆβ k x

k

2

  • (^) This optimization problem has a unique solution βˆLS 0

LS k

. Hereafter we

drop the “LS” superscript.

  • (^) There are formulas for the βˆ

i ’s in terms of the^ yi ’s and powers of^ xi ’s, but

they are not enlightening. JMP does the computations for you.

  • (^) The unbiased estimate of σ 2

is now σˆ

2

= RSS/( n − ( k + 1 )), rather than

RSS/( n − 2 ).

Example: transformations vs polynomials

  • (^) Traffic planners often refer to results from a classic study done in 1989 for

the Maryland Planning Commission by Douglas & Douglas Inc. The study

was done in Montgomery County, MD.

  • (^) The goal of the study was to learn how to predict the volume of traffic

associated with office buildings. Such information is useful for several

purposes.

  • (^) For example, if a new office building of 350,000 sq. ft. were being planned,

planners and zoning administrators, etc., would need to know how much

additional traffic to expect after the building was completed and occupied.

  • (^) The data here are from traffic counts over a period of time at 61 office

building sites within the county.

  • (^) The predictor variable is the size of the building, measured in occupied

gross square feet of floor space (1000 sq. ft. units).

  • (^) The response variable is the average daily number of vehicle trips

originating at or near the building site during the AM hours.

Here is a scatterplot of the data:

AM Trips By Occup. Sq. Ft. ( 1000 ) AM Trips

  1. 0
  2. 0
  3. 0
  4. 0
  5. 0
  6. 0
  7. 0

. 00 100. 00 300. 00 500. 00 Occup. Sq. Ft. ( 1000 )

Linear Fit

AM Trips = -7.939 + 1.697 Occup. Sq. Ft. (1000)

Summary of Fit

RSquare 0. 800

  • (^) It is not always true that heteroscedasticity also involves an undesirable

distribution of residuals, But it does here:

There’s very noticeable heteroscedasticity. (You can also see this on th scatterplot itself.) It is NOT always true that heteroscedasticity also involves an undesirabl histogram of residuals. But it certainly does so here: Residuals AM Trips

  • 400
  • 300
  • 200
  • 100 0 100 200 300 400 500 . 01. 05. 10. 25. 50. 75. 90. 95. 99
  • 2 - 1 0 1 2 3 Normal Quantile Plot Test for Normality - Shapiro-Wilk W Test: W =. 876 P - v a l u e <. 0 0 0 1

Transformation attempt 1

  • (^) Since the (vertical) spread of the data increases as the y -value increases,

a log transformation may cure this heteroscedasticity. Here are the results

of transforming y to log( y ).

  • (^) This transformation has pretty much cured the heteroscedasticity present

in the original analysis.

  • (^) It has degraded the R 2

(reduced from .80 to .76), but this by itself would not

be a reason to discard this version, since the preceding analysis was not

valid.

  • (^) However, the new analysis has a new problem: there’s an undesirable

degree of non-linearity evident in both the residual plot and the scatterplot.

  • (^) Once we have a clear nonlinear pattern interfering with the validity of the

analysis, it doesn’t much matter whether the residuals are normal or not.

For curiosity’s sake, here is the diagnostic; in this case, they turn out to

appear acceptably normal.

Residuals Log_ 10 AMTrips

    1. 5
    1. 4
    1. 3
    1. 2
    1. 1
  • 3 e- 17
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5 . 01. 05. 10. 25. 50. 75. 90. 95. 99
  • 2 - 1 0 1 2 3 Normal Quantile Plot Test for Normality Shapiro-Wilk W Test W P r o b < W
  1. 956 0. 0651