Post on 22-Feb-2016
description
transcript
Chapter 8
Heteroskedasticity
Adapted from Vera Tabakova’s notes
ECON 4551 Econometrics IIMemorial University of Newfoundland
Chapter 8: Heteroskedasticity
8.1 The Nature of Heteroskedasticity 8.2 Using the Least Squares Estimator 8.3 The Generalized Least Squares Estimator 8.4 Detecting Heteroskedasticity
Slide 8-2Principles of Econometrics, 3rd Edition
8.1 The Nature of Heteroskedasticity
Slide 8-3Principles of Econometrics, 3rd Edition
(8.1)
(8.2)
(8.3)
1 2( )E y x
1 2( )i i i i ie y E y y x
1 2i i iy x e
8.1 The Nature of Heteroskedasticity
Figure 8.1 Heteroskedastic Errors
Slide 8-4Principles of Econometrics, 3rd Edition
8.1 The Nature of Heteroskedasticity
Slide 8-5Principles of Econometrics, 3rd Edition
(8.4)
2( ) 0 var( ) cov( , ) 0i i i jE e e e e
var( ) var( ) ( )i i iy e h x
ˆ 83.42 10.21i iy x
ˆ 83.42 10.21i i ie y x
Food expenditure example:
8.1 The Nature of Heteroskedasticity
Figure 8.2 Least Squares Estimated Expenditure Function and Observed Data Points
Slide 8-6Principles of Econometrics, 3rd Edition
8.2 Using the Least Squares Estimator
The existence of heteroskedasticity implies: The least squares estimator is still a linear and unbiased estimator, but
it is no longer best. There is another estimator with a smaller
variance. The standard errors usually computed for the least squares estimator
are incorrect. Confidence intervals and hypothesis tests that use these
standard errors may be misleading.
Slide 8-7Principles of Econometrics, 3rd Edition
8.2 Using the Least Squares Estimator
Slide 8-8Principles of Econometrics, 3rd Edition
(8.5)
(8.6)
(8.7)
21 2 var( )i i i iy x e e
2
22
1
var( )( )
N
ii
bx x
21 2 var( )i i i i iy x e e
8.2 Using the Least Squares Estimator
Slide 8-9Principles of Econometrics, 3rd Edition
(8.8)
(8.9)
2 2
2 2 12 2
1 2
1
( )var( )
( )
N
i iNi
i i Nii
i
x xb w
x x
2 2
2 2 12 2
1 2
1
ˆ( )ˆvar( )
( )
N
i iNi
i i Nii
i
x x eb w e
x x
8.2 Using the Least Squares Estimator
Slide 8-10Principles of Econometrics, 3rd Edition
ˆ 83.42 10.21(27.46) (1.81) (White se)(43.41) (2.09) (incorrect se)
i iy x
2 2
2 2
White: se( ) 10.21 2.024 1.81 [6.55, 13.87]
Incorrect: se( ) 10.21 2.024 2.09 [5.97, 14.45]
c
c
b t b
b t b
We can use a robust estimator: GRETL offers several options…check the defaults
8.2 Using the robust estimator
The existence of heteroskedasticity implies: Why not use robust estimation all the time? Well, that is a good idea for large samples but for small samples,
homoskedasticity plus normality guarantees that the t ratios are
distributed as t But robust estimates do not guarantee that, so our inference could be
misleading! If you have a small sample, check whether there is homoskedasticity
or not!Slide 8-11Principles of Econometrics, 3rd Edition
8.3 The Generalized Least Squares Estimator
Slide 8-12Principles of Econometrics, 3rd Edition
(8.10)1 2
2( ) 0 var( ) cov( , ) 0
i i i
i i i i j
y x e
E e e e e
8.3.1 Transforming the Model
Slide 8-13Principles of Econometrics, 3rd Edition
(8.11)
(8.12)
(8.13)
2 2var i i ie x
1 21i i i
i i i i
y x ex x x x
1 21 i i i
i i i i ii i i i
y x ey x x x ex x x x
8.3.1 Transforming the Model
Slide 8-14Principles of Econometrics, 3rd Edition
(8.14)
(8.15)
1 1 2 2i i i iy x x e
2 21 1var( ) var var( )ii i i
i ii
ee e xx xx
8.3.1 Transforming the Model
To obtain the best linear unbiased estimator for a model with
heteroskedasticity of the type specified in equation (8.11):
1. Calculate the transformed variables given in (8.13).
2. Use least squares to estimate the transformed model given in (8.14).
Slide 8-15Principles of Econometrics, 3rd Edition
8.3.1 Transforming the Model
The generalized least squares estimator is as a weighted least
squares estimator. Minimizing the sum of squared transformed errors
that is given by:
When is small, the data contain more information about the
regression function and the observations are weighted heavily.
When is large, the data contain less information and the
observations are weighted lightly.Slide 8-16Principles of Econometrics, 3rd Edition
22 1/2 2
1 1 1( )
N N Ni
i i ii i ii
ee x ex
ix
ix
8.3.1 Transforming the Model
Slide 8-17Principles of Econometrics, 3rd Edition
(8.16)ˆ 78.68 10.45
(se) (23.79) (1.39)i iy x
2 2ˆ ˆse( ) 10.451 2.024 1.386 [7.65,13.26]ct
Food example again, where was the problem coming from?
regress food_exp income [aweight = 1/income]
8.3.2 Estimating the Variance Function
Slide 8-18Principles of Econometrics, 3rd Edition
(8.17)
(8.18)
2 2var( )i i ie x
2 2ln( ) ln( ) ln( )i ix
2 2
1 2
exp ln( ) ln( )
exp( )
i i
i
x
z
8.3.2 Estimating the Variance Function
Slide 8-19Principles of Econometrics, 3rd Edition
(8.19)
(8.20)
21 2 2exp( )i i s iSz z
21 2ln( )i iz
1 2( )i i i i iy E y e x e
8.3.2 Estimating the Variance Function
Slide 8-20Principles of Econometrics, 3rd Edition
(8.21)2 21 2ˆln( ) ln( )i i i i ie v z v
2ˆln( ) .9378 2.329i iz
21 1ˆ ˆˆ exp( )i iz
1 21i i i
i i i i
y x e
8.3.2 Estimating the Variance Function
Slide 8-21Principles of Econometrics, 3rd Edition
(8.22)
(8.24)
(8.23)
22 2
1 1var var( ) 1ii i
i i i
e e
1 21
ˆ ˆ ˆi i
i i ii i i
y xy x x
1 1 2 2i i i iy x x e
8.3.2 Estimating the Variance Function
Slide 8-22Principles of Econometrics, 3rd Edition
(8.25)
(8.26)
1 2 2i i k iK iy x x e
21 2 2var( ) exp( )i i i s iSe z z
8.3.2 Estimating the Variance Function
The steps for obtaining a feasible generalized least squares estimator
for are:
1. Estimate (8.25) by least squares and compute the squares of
the least squares residuals . 2. Estimate by applying least squares to the equation
Slide 8-23Principles of Econometrics, 3rd Edition
1 2, , , K
2ie
1 2, , , S
21 2 2ˆln i i S iS ie z z v
8.3.2 Estimating the Variance Function
3. Compute variance estimates .
4. Compute the transformed observations defined by (8.23),
including if .
5. Apply least squares to (8.24), or to an extended version of
(8.24) if .
Slide 8-24Principles of Econometrics, 3rd Edition
21 2 2ˆ ˆ ˆˆ exp( )i i S iSz z
3, ,i iKx x 2K
2K
(8.27)ˆ 76.05 10.63
(se) (9.71) (.97)iy x
8.3.2 Estimating the Variance Function
Slide 8-25Principles of Econometrics, 3rd Edition
For our food expenditure example (GRETL:
#Estimating the skedasticity function and GLS ols y const xgenr lnsighat = log($uhat*$uhat)genr z = log(x)
#Obtain prediction of variance:ols lnsighat const zgenr predsighat = exp($yhat)
#generate weights;genr w = 1/predsighat
wls w y const x
8.3.2 Estimating the Variance Function
Slide 8-26Principles of Econometrics, 3rd Edition
For our food expenditure example (STATA):
gen z = log(income)regress food_exp incomepredict ehat, residualgen lnehat2 = log(ehat*ehat)regress lnehat2 z
* --------------------------------------------* Feasible GLS* --------------------------------------------predict sig2, xbgen wt = exp(sig2)regress food_exp income [aweight = 1/wt]
8.3.3 A Heteroskedastic Partition
Slide 8-27Principles of Econometrics, 3rd Edition
(8.28)
(8.29b)
(8.29a)
9.914 1.234 .133 1.524(se) (1.08) (.070) (.015) (.431)WAGE EDUC EXPER METRO
1 2 3 1,2, ,Mi M Mi Mi Mi MWAGE EDUC EXPER e i N
1 2 3 1,2, ,Ri R Ri Ri Ri RWAGE EDUC EXPER e i N
1 9.914 1.524 8.39Mb
Using our wage data (cps2.dta):
???
8.3.3 A Heteroskedastic Partition
Slide 8-28Principles of Econometrics, 3rd Edition
(8.30)2 2var( ) var( )Mi M Ri Re e
2 2ˆ ˆ31.824 15.243M R
1 2 3
1 2 3
9.052 1.282 .1346
6.166 .956 .1260
M M M
R R R
b b b
b b b
8.3.3 A Heteroskedastic Partition
Slide 8-29Principles of Econometrics, 3rd Edition
(8.31b)
(8.31a)1 2 3
1Mi Mi Mi MiM
M M M M M
WAGE EDUC EXPER e
1,2, , Mi N
1 2 31Ri Ri Ri Ri
RR R R R R
WAGE EDUC EXPER e
1,2, , Ri N
8.3.3 A Heteroskedastic Partition
Feasible generalized least squares:
1. Obtain estimated and by applying least squares separately to
the metropolitan and rural observations.
2.
3. Apply least squares to the transformed model
Slide 8-30Principles of Econometrics, 3rd Edition
(8.32)
ˆ M ˆ R
ˆ when 1ˆ
ˆ when 0
M i
i
R i
METRO
METRO
1 2 31
ˆ ˆ ˆ ˆ ˆ ˆi i i i i
Ri i i i i i
WAGE EDUC EXPER METRO e
8.3.3 A Heteroskedastic Partition
Slide 8-31Principles of Econometrics, 3rd Edition
(8.33) 9.398 1.196 .132 1.539(se) (1.02) (.069) (.015) (.346)WAGE EDUC EXPER METRO
_cons -9.398362 1.019673 -9.22 0.000 -11.39931 -7.397408 metro 1.538803 .3462856 4.44 0.000 .8592702 2.218336 exper .1322088 .0145485 9.09 0.000 .1036595 .160758 educ 1.195721 .068508 17.45 0.000 1.061284 1.330157 wage Coef. Std. Err. t P>|t| [95% Conf. Interval]
Total 36081.2155 999 36.1173328 Root MSE = 5.1371 Adj R-squared = 0.2693 Residual 26284.1488 996 26.3897076 R-squared = 0.2715 Model 9797.0667 3 3265.6889 Prob > F = 0.0000 F( 3, 996) = 123.75 Source SS df MS Number of obs = 1000
(sum of wgt is 3.7986e+01). regress wage educ exper metro [aweight = 1/wt]
8.3.3 A Heteroskedastic Partition
Slide 8-32Principles of Econometrics, 3rd Edition
* --------------------------------------------* Rural subsample regression* --------------------------------------------regress wage educ exper if metro == 0 scalar rmse_r = e(rmse)scalar df_r = e(df_r)* --------------------------------------------* Urban subsample regression* --------------------------------------------regress wage educ exper if metro == 1 scalar rmse_m = e(rmse)scalar df_m = e(df_r)* --------------------------------------------* Groupwise heteroskedastic regression using FGLS* --------------------------------------------gen rural = 1 - metrogen wt=(rmse_r^2*rural) + (rmse_m^2*metro)regress wage educ exper metro [aweight = 1/wt]
STATA Commands:
8.3.3 A Heteroskedastic Partition
Slide 8-33Principles of Econometrics, 3rd Edition
#Wage Exampleopen "c:\Program Files\gretl\data\poe\cps2.gdt"ols wage const educ exper metro
# Use only metro observationssmpl metro --dummyols wage const educ experscalar stdm = $sigma
#Restore the full samplesmpl full
GRETL Commands:
8.3.3 A Heteroskedastic Partition
Slide 8-34Principles of Econometrics, 3rd Edition
#Create a dummy variable for ruralgenr rural = 1-metro
#Restrict sample to rural observationssmpl rural --dummyols wage const educ experscalar stdr = $sigma
#Restore the full samplesmpl full
GRETL Commands:
#Generate standard deviations for each metro and rural obs
genr wm = metro*stdm genr wr = rural*stdr
#Make the weights (reciprocal) #Remember, Gretl's wls needs these to be variances so
you'll need to square them genr w = 1/(wm + wr)^2
#Weighted least squares wls w wage const educ exper metro
Principles of Econometrics, 3rd Edition
8.3.3 A Heteroskedastic Partition
Slide 8-36Principles of Econometrics, 3rd Edition
Remark: To implement the generalized least squares estimators
described in this Section for three alternative heteroskedastic
specifications, an assumption about the form of the
heteroskedasticity is required. Using least squares with White
standard errors avoids the need to make an assumption about the
form of heteroskedasticity, but does not realize the potential
efficiency gains from generalized least squares.
8.4 Detecting Heteroskedasticity
8.4.1 Residual Plots
Estimate the model using least squares and plot the least squares
residuals. With more than one explanatory variable, plot the least squares
residuals against each explanatory variable, or against , to see if
those residuals vary in a systematic way relative to the specified
variable.
Slide 8-37Principles of Econometrics, 3rd Edition
ˆiy
8.4 Detecting Heteroskedasticity
8.4.2 The Goldfeld-Quandt Test
Slide 8-38Principles of Econometrics, 3rd Edition
(8.34)
(8.35)
2 2
( , )2 2
ˆˆ M M R R
M MN K N K
R R
F F
2 2 2 20 0: against :M R M RH H
2
2
ˆ 31.824 2.09ˆ 15.243
M
R
F
8.4 Detecting Heteroskedasticity
8.4.2 The Goldfeld-Quandt Test
Slide 8-39Principles of Econometrics, 3rd Edition
2
2
ˆ 31.824 2.09ˆ 15.243
M
R
F
STATA:* --------------------------------------------* Goldfeld Quandt test* --------------------------------------------
scalar GQ = rmse_m^2/rmse_r^2scalar crit = invFtail(df_m,df_r,.05)scalar pvalue = Ftail(df_m,df_r,GQ)scalar list GQ pvalue crit
GRETL:
#Goldfeld Quandt statisticscalar fstatistic = stdm^2/stdr^2
8.4 Detecting Heteroskedasticity
8.4.2 The Goldfeld-Quandt Test
Slide 8-40Principles of Econometrics, 3rd Edition
21ˆ 3574.8
22ˆ 12,921.9
2221
ˆ 12,921.9 3.61ˆ 3574.8
F
More generally, the test can be based Simply on a continuous variable
Split the sample in halves (usually omittingsome from the middle) after orderingthem according to the suspected variable(income in our food example)
8.4 Detecting Heteroskedasticity
8.4.2 The Goldfeld-Quandt Test
Slide 8-41Principles of Econometrics, 3rd Edition
21ˆ 3574.8
22ˆ 12,921.9
2221
ˆ 12,921.9 3.61ˆ 3574.8
F
For the food expenditure data
You should now be able to obtain this test statistic
And check whether it exceeds the critical value
Remember that you can probably use the one-tail version of this testWhy?
8.4 Detecting Heteroskedasticity
8.4.3 Testing the Variance Function
Slide 8-42Principles of Econometrics, 3rd Edition
(8.36)
(8.37)
1 2 2( )i i i i K iK iy E y e x x e
2 21 2 2var( ) ( ) ( )i i i i S iSy E e h z z
1 2 2 1 2 2( ) exp( )i S iS i S iSh z z z z
21 2( ) exp ln( ) ln( )i ih z x
For the mean:
For the variance, in general:
For example::
8.4 Detecting Heteroskedasticity
8.4.3 Testing the Variance Function
Slide 8-43Principles of Econometrics, 3rd Edition
(8.38)
(8.39)
1 2 2 1 2 2( )i S iS i S iSh z z z z
1 2 2 1( ) ( )i S iSh z z h
0 2 3
1 0
: 0
: not all the in are zero
S
s
H
H H
8.4 Detecting Heteroskedasticity
8.4.3 Testing the Variance Function
Slide 8-44Principles of Econometrics, 3rd Edition
(8.40)
(8.41)
2 21 2 2var( ) ( )i i i i S iSy E e z z
2 21 2 2( )i i i i S iS ie E e v z z v
(8.42)2
1 2 2i i S iS ie z z v
(8.43)2 2 2
( 1)SN R
S is the number of variables used
This is a large sample test It is a Lagrange Multiplier (LM) test,
which are based on an auxiliary regression
In this case named after Breusch and Pagan
Here (and in the textbook) we saw a test statistic based on a linear function of the squared residual, but the good thing about this test is that this form can be used to test for any form of heteroskedasticity
Principles of Econometrics, 3rd Edition
8.4 Detecting Heteroskedasticity
8.4.3a The White Test
Slide 8-46Principles of Econometrics, 3rd Edition
1 2 2 3 3( )i i iE y x x
2 22 2 3 3 4 2 5 3z x z x z x z x
Since we may not know which variables explain heteroskedasticity…
8.4 Detecting Heteroskedasticity
8.4.3b Testing the Food Expenditure Example
Slide 8-47Principles of Econometrics, 3rd Edition
4,610,749,441 3,759,556,169SST SSE
2 1 .1846SSERSST
2 2 40 .1846 7.38N R
2 2 40 .18888 7.555 -value .023N R p
whitetst
Or
estat imtest, whiteBreusch-Pagan test
White test
STATA:
GRETL: ols y const xmodtest --breusch-paganmodtest –white
Keywords
Slide 8-48Principles of Econometrics, 3rd Edition
Breusch-Pagan test generalized least squares Goldfeld-Quandt test heteroskedastic partition heteroskedasticity heteroskedasticity-consistent
standard errors homoskedasticity Lagrange multiplier test mean function residual plot transformed model variance function weighted least squares White test
Chapter 8 Appendices
Slide 8-49Principles of Econometrics, 3rd Edition
Appendix 8A Properties of the Least Squares
Estimator Appendix 8B Variance Function Tests for
Heteroskedasticity
Appendix 8A Properties of the Least Squares Estimator
Slide 8-50Principles of Econometrics, 3rd Edition
(8A.1)
1 2i i iy x e
2( ) 0 var( ) cov( , ) 0 ( )i i i i jE e e e e i j
2 2 i ib w e
2i
ii
x xwx x
Appendix 8A Properties of the Least Squares Estimator
Slide 8-51Principles of Econometrics, 3rd Edition
2 2
2 2
i i
i i
E b E E w e
w E e
Appendix 8A Properties of the Least Squares Estimator
Slide 8-52Principles of Econometrics, 3rd Edition
(8A.2)
2
2
2 2
2 2
22
var var
var cov ,
( )
( )
i i
i i i j i ji j
i i
i i
i
b w e
w e w w e e
w
x x
x x
Appendix 8A Properties of the Least Squares Estimator
Slide 8-53Principles of Econometrics, 3rd Edition
(8A.3)
2
2 2var( )i
bx x
Appendix 8B Variance Function Tests for Heteroskedasticity
Slide 8-54Principles of Econometrics, 3rd Edition
(8B.2)
(8B.1)21 2 2i i S iS ie z z v
( ) / ( 1)/ ( )
SST SSE SFSSE N S
2
2 2 2
1 1ˆ ˆ ˆ and
N N
i ii i
SST e e SSE v
Appendix 8B Variance Function Tests for Heteroskedasticity
Slide 8-55Principles of Econometrics, 3rd Edition
(8B.4)
(8B.3)2 2( 1)( 1)
/ ( ) SSST SSES F
SSE N S
2var( ) var( )i iSSEe v
N S
(8B.5)2
2var( )i
SST SSE
e
Appendix 8B Variance Function Tests for Heteroskedasticity
Slide 8-56Principles of Econometrics, 3rd Edition
(8B.6)
(8B.7)
24ˆ2 e
SST SSE
22 2 4
2 4
1var 2 var( ) 2 var( ) 2ii i e
e e
e e e
2 2 2 2
1
1 ˆ ˆvar( ) ( )N
i ii
SSTe e eN N
Appendix 8B Variance Function Tests for Heteroskedasticity
Slide 8-57Principles of Econometrics, 3rd Edition
(8B.8)
2
2
/
1
SST SSESST N
SSENSST
N R