580 likes | 731 Views
ECON 4551 Econometrics II Memorial University of Newfoundland. Heteroskedasticity. Chapter 8. Adapted from Vera Tabakova’s notes . Chapter 8: Heteroskedasticity. 8.1 The Nature of Heteroskedasticity 8.2 Using the Least Squares Estimator 8.3 The Generalized Least Squares Estimator
E N D
ECON 4551 Econometrics II Memorial University of Newfoundland Heteroskedasticity Chapter 8 Adapted from Vera Tabakova’s notes
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 Principles of Econometrics, 3rd Edition
8.1 The Nature of Heteroskedasticity Principles of Econometrics, 3rd Edition
8.1 The Nature of Heteroskedasticity Figure 8.1 Heteroskedastic Errors Principles of Econometrics, 3rd Edition
8.1 The Nature of Heteroskedasticity Food expenditure example: Principles of Econometrics, 3rd Edition
8.1 The Nature of Heteroskedasticity Figure 8.2 Least Squares Estimated Expenditure Function and Observed Data Points Principles 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. Principles of Econometrics, 3rd Edition
8.2 Using the Least Squares Estimator Principles of Econometrics, 3rd Edition
8.2 Using the Least Squares Estimator Principles of Econometrics, 3rd Edition
8.2 Using the Least Squares Estimator We can use a robust estimator: GRETL offers several options…check the defaults Principles of Econometrics, 3rd Edition
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! Principles of Econometrics, 3rd Edition
8.3 The Generalized Least Squares Estimator Principles of Econometrics, 3rd Edition
8.3.1 Transforming the Model Principles of Econometrics, 3rd Edition
8.3.1 Transforming the Model Principles of Econometrics, 3rd Edition
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): • Calculate the transformed variables given in (8.13). • Use least squares to estimate the transformed model given in (8.14). Principles of Econometrics, 3rd Edition
8.3.1 Transforming the Model The generalized least squares estimator is as a weighted least squaresestimator. 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. Principles of Econometrics, 3rd Edition
8.3.1 Transforming the Model Food example again, where was the problem coming from? regress food_exp income [aweight = 1/income] Principles of Econometrics, 3rd Edition
8.3.2 Estimating the Variance Function Principles of Econometrics, 3rd Edition
8.3.2 Estimating the Variance Function Principles of Econometrics, 3rd Edition
8.3.2 Estimating the Variance Function Principles of Econometrics, 3rd Edition
8.3.2 Estimating the Variance Function Principles of Econometrics, 3rd Edition
8.3.2 Estimating the Variance Function Principles of Econometrics, 3rd Edition
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 Principles of Econometrics, 3rd Edition
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 . Principles of Econometrics, 3rd Edition
8.3.2 Estimating the Variance Function For our food expenditure example (GRETL: #Estimating the skedasticity function and GLS ols y const x genrlnsighat = log($uhat*$uhat) genr z = log(x) #Obtain prediction of variance: olslnsighat const z genrpredsighat = exp($yhat) #generate weights; genr w = 1/predsighat wls w y const x Principles of Econometrics, 3rd Edition Slide 8-25
8.3.2 Estimating the Variance Function For our food expenditure example (STATA): gen z = log(income) regress food_exp income predict ehat, residual gen lnehat2 = log(ehat*ehat) regress lnehat2 z * -------------------------------------------- * Feasible GLS * -------------------------------------------- predict sig2, xb gen wt = exp(sig2) regress food_exp income [aweight = 1/wt] Principles of Econometrics, 3rd Edition Slide 8-26
8.3.3 A Heteroskedastic Partition Using our wage data (cps2.dta): ??? Principles of Econometrics, 3rd Edition
8.3.3 A Heteroskedastic Partition Principles of Econometrics, 3rd Edition
8.3.3 A Heteroskedastic Partition Principles of Econometrics, 3rd Edition
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 Principles of Econometrics, 3rd Edition
8.3.3 A Heteroskedastic Partition Principles of Econometrics, 3rd Edition
8.3.3 A Heteroskedastic Partition * -------------------------------------------- * 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 - metro gen wt=(rmse_r^2*rural) + (rmse_m^2*metro) regress wage educ exper metro [aweight = 1/wt] STATA Commands: Principles of Econometrics, 3rd Edition Slide 8-32
8.3.3 A Heteroskedastic Partition #Wage Example open "c:\Program Files\gretl\data\poe\cps2.gdt" ols wage const educexper metro # Use only metro observations smpl metro --dummy ols wage const educexper scalar stdm = $sigma #Restore the full sample smpl full GRETL Commands: Principles of Econometrics, 3rd Edition Slide 8-33
8.3.3 A Heteroskedastic Partition #Create a dummy variable for rural genr rural = 1-metro #Restrict sample to rural observations smpl rural --dummy ols wage const educexper scalar stdr = $sigma #Restore the full sample smpl full GRETL Commands: Principles of Econometrics, 3rd Edition Slide 8-34
#Generate standard deviations for each metro and rural obs • genr wm = metro*stdm • genrwr = rural*stdr • #Make the weights (reciprocal) • #Remember, Gretl'swls 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 educexper metro Principles of Econometrics, 3rd Edition
8.3.3 A Heteroskedastic Partition Principles of Econometrics, 3rd Edition
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. Principles of Econometrics, 3rd Edition
8.4 Detecting Heteroskedasticity 8.4.2 The Goldfeld-Quandt Test Principles of Econometrics, 3rd Edition
8.4 Detecting Heteroskedasticity STATA: * -------------------------------------------- * GoldfeldQuandt test * -------------------------------------------- scalar GQ = rmse_m^2/rmse_r^2 scalar crit = invFtail(df_m,df_r,.05) scalar pvalue = Ftail(df_m,df_r,GQ) scalar list GQ pvaluecrit GRETL: #GoldfeldQuandt statistic scalar fstatistic = stdm^2/stdr^2 Principles of Econometrics, 3rd Edition Slide 8-39 8.4.2 The Goldfeld-Quandt Test
8.4 Detecting Heteroskedasticity 8.4.2 The Goldfeld-Quandt Test More generally, the test can be based Simply on a continuous variable Split the sample in halves (usually omitting some from the middle) after ordering them according to the suspected variable (income in our food example) Principles of Econometrics, 3rd Edition
8.4 Detecting Heteroskedasticity 8.4.2 The Goldfeld-Quandt Test 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 test Why? Principles of Econometrics, 3rd Edition
8.4 Detecting Heteroskedasticity 8.4.3 Testing the Variance Function For the mean: For the variance, in general: For example:: Principles of Econometrics, 3rd Edition
8.4 Detecting Heteroskedasticity 8.4.3 Testing the Variance Function Principles of Econometrics, 3rd Edition
8.4 Detecting Heteroskedasticity 8.4.3 Testing the Variance Function S is the number of variables used Principles of Econometrics, 3rd Edition
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 Since we may not know which variables explain heteroskedasticity… Principles of Econometrics, 3rd Edition
8.4 Detecting Heteroskedasticity 8.4.3b Testing the Food Expenditure Example STATA: whitetst Or estat imtest, white Breusch-Pagan test White test GRETL: ols y const x modtest --breusch-pagan modtest –white Principles of Econometrics, 3rd Edition
Keywords • 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 Principles of Econometrics, 3rd Edition
Chapter 8 Appendices • Appendix 8A Properties of the Least Squares Estimator • Appendix 8B Variance Function Tests for Heteroskedasticity Principles of Econometrics, 3rd Edition
Appendix 8A Properties of the Least Squares Estimator Principles of Econometrics, 3rd Edition