Analysis of Cross Section and Panel Data Yan Zhang School of Economics, Fudan University CCER, Fudan University Introductory Econometrics A Modern Approach Yan Zhang School of Economics, Fudan University CCER, Fudan University Analysis of Cross Section and Panel Data Part 1. Regression Analysis on Cross Sectional Data Chap 8. Heteroskedasticity Heteroskedasticity Robust statistic Heteroskedasticity-robust t statistic Heteroskedasticity-robust s.e. (White-Huber-Eicker s.e.) Heteroskedasticity-robust F statistic Heteroskedasticity-robust LM statistic 异方差检验方法:B-P方法;White方法; 异方差处理:GLS FGLS 8.1 Consequences of Heteroskedasticity for OLS Heteroskedasticity Not Change: Unbiasedness Consistency Change: Biased variance of OLS estimator, Invalid t, F, LM statistic OLS No longer BLUE OLS no longer asymptotically efficient Solutions: Modify the OLS test statistics More efficient estimator 8.2 Heteroskedasticity-Robust Inferences after OLS Estimation Heteroskedasticity-Robust procedures how to adjust standard errors, t, F, and LM statistics so that they are valid in the presence of heteroskedasticity of unknown form. Robust statistic Heteroskedasticity-robust t statistic Heteroskedasticity-robust s.e. (White-Huber- Eicker s.e.) Heteroskedasticity-robust F statistic Heteroskedasticity-robust LM statistic (E.g 5.3, 8.3) Example 8.1 (7.6, 7.1, 7.5) The Determination of log Hourly Wage: Stata Command use WAGE1 generate marrmale=married*(1-female) generate marrfem=married*female generate singfem=(1-married)*female reg lwage marrmale marrfem singfem educ exper expersq tenure tenursq test tenure tenuresq reg lwage marrmale marrfem singfem educ exper expersq tenure tenursq, robust test tenure tenuresq (Heteroskedasticity-robust F statistic) Example 8.1 (7.6, 7.1, 7.5) The Determination of log Hourly Wage: Heteroskedasticity-Robust The Standard Error same coef., R-squared and Adjusted Rsquared (Unbias) Different s.e., t-statistic, p-value, CI, F-statistic Example 8.1 (7.6): Notice Dummy Variables: Same “marriage premium”; (0,1); (1,1); (1,0); (0,0) Different “marriage premium”; (1,0,0); (0,1,0); (0,0,1); (0,0,0) Adding Interaction Term Inference: we can use this equation to obtain the estimated difference between any two groups. Unfortunately, we cannot use it for testing whether the estimated difference between single and married women is statistically significant. to choose one of these groups to be the base group and to reestimate the equation. Example 8.2: The Determination of GPA Stata Command use GPA3 describe reg cumgpa sat hsperc tothrs female black white if spring==1 test black white regress cumgpa sat hsperc tothrs female black white if spring>0, robust test black white (Heteroskedasticity-robust F statistic) The Determination of GPA:补充 Chap 7.4.3——Chow Statistic Stata Command gen fmsat=female*sat gen fmhsperc=female* hsperc gen fmtothrs=female*tothrs label variable fmsat “=female*sat” label variable fmhsperc "=female*hsperc" label variable fmtothrs"=female*tothrs" reg cumgpa female sat fmsat hsperc fmhsperc tothrs fmtothrs if spring==1 test female fmsat fmhsperc fmtothrs test fmsat fmhsperc fmtothrs reg cumgpa female sat hsperc tothrs if spring==1 8.3 Testing for Heteroskedasticity Heteroskedasticity-Robust s.e.——不需知道是否存在 异方差 Testing for Heteroskedasticity The Breusch-Pagan Test (B-P Test) The White Test Basic Methods BP Test White Test 8.3.1 The Breusch-Pagan Test (BP Test) for Heteroskedasticity The Breusch-Pagan Test (B-P Test) Basic Methods Heteroskedasticity BP Test Heteroskedasticity White Test 8.3.2 The White Test for Heteroskedasticity The White Test (B-P Test) adds the squares and cross products of all of the independent variables to equation (8.14). The procedure of White Test Notice: Problems with Heteroskedasticity Tests Can we always take a rejection using one of the heteroskedasticity tests as evidence of heteroskedasticity? appropriate provided we maintain Assumptions MLR.1 through MLR.4. But, if MLR.3 is violated—in particular, if the functional form of E(y x) is misspecified—then a test for heteroskedastcity can reject H0, even if Var(y/x) is constant. If we omit one or more quadratic terms in a regression model or use the level model when we should use the log, a test for heteroskedasticity can be significant. 8.4 Weighted Least Square Estimations (WLS) Methods: Var(u/x)=σ2 Ω Ω-1 =P’P Y=XB+u B^=(X’ Ω-1 X) -1(X’ Ω-1 Y) WLS Weight: The efficient procedure, GLS, weights each squared residual by the inverse of the conditional variance of ui given xi Examples of GLS The R-squares of OLS and WLS are not comparable Example 8.6: Family Saving Function Marginal Propensity to Save: STATA Command: help weights; use saving reg sav inc; reg sav inc size educ age black; the var. of the error is proportional to the level of income This means that, as income increases, the variability in savings increases. test size educ age black reg sav inc [pw=1/inc]; reg sav inc size educ age black [pw=1/inc] test size educ age black Notice: not comparable R-squares compare the coef.——either is good adding demographic control variables——individually and jointly insignificant Notice: The Weights Unknown One case where the weights needed for WLS arise naturally from an underlying econometric model. Individual level data——data across some group (firm- level) or geographic region A similar weighting arises when we are using per capita data at the city, county, state, or country level. If the individual-level equation satisfies the Gauss-Markov assumptions, then the error in the per capita equation has a variance proportional to one over the size of the population. Therefore, weighted least squares with weights equal to the population is appropriate. 8.4.2 Feasible GLS: The Heteroskedasticity F. Must Be Estimated FGLS Estimator: Using the estimator, , instead of hi in the GLS transformation yields an estimator (model the function h and use the data to estimate the unknown parameters) One FGLS: Procedure: Notice: The Properties of FGLS The FGLS estimator is neither unbiased, nor BLUE The FGLS estimator is still consistent, and asymptotically more efficient than OLS for large sample sizes, FGLS is an attractive alternative to OLS when there is evidence of heteroskedasticity that inflates the standard errors of the OLS estimates. The FGLS estimator measures the marginal impact of each xj on y, The F statistic with WLS: same weights in both restricted and unrestricted models Compare with the OLS and WLS Estimators the OLS and WLS estimates can be substantially different. Not a big problem in the e.g.——all the coefficients maintain the same signs, and the biggest changes are on variables that were statistically insignificant when the equation was estimated by OLS. The OLS and WLS estimates will always differ due to sampling error. The issue is whether their difference is enough to change important conclusions. If OLS and WLS produce statistically significant estimates that differ in sign, or the difference in magnitudes of the estimates is practically large, we should be suspicious. Typically, this indicates that one of the other Gauss-Markov assumptions is false, particularly the zero conditional mean assumption on the error (MLR.3). Hausman Test Example 8.7: Demand for Cigarettes Homework OLS BP test FGLS Interpretation Chap 9. More on Specification and Data Problem Functional Form Misspecification Heteroskedasticity assumption 3, zero conditional mean correlation between the error, u, and one or more of the explanatory variables. Endogenous Explanatory Variable Specific problem and Solutions Omitting v. Proxy Variable measurement error Data Problem 9.1 Functional Form Misspecification 表现:多元回归模型没有正确的解释因变量和观测到的解释变量之间的 关系 E.g.: Explanatory variables: Log-wage: the return to working experience, exper2 Biased estimator of all coef.s Log-wage: the return to education, female*educ explanation Explained Variable Log-wage wage Unobservable key variable 检验:the F test for joint exclusion restrictions. 增加一个显著变量的平方项,进行联合显著性检验 缺点:无法确定函数形式误设的确切原因;使用大量自由度 一般情形下,对数形式和平方项 RESET as a General Test for Functional Form Misspecification RESET: Regression Specification Error Test (回归设定误差检验) Idea:RESET adds polynomials in the OLS fitted values to equation (9.2) to detect general kinds of functional form misspecification. Drawbacks: it provides no real direction on how to proceed if the model is rejected. Just a Functional Form Test, Misguide on omitted v. and heteroskedasticity RESET has no power for detecting omitted v. whenever they have expectations that are linear in the included independent v. in the model if the functional form is properly specified, RESET has no power for detecting heteroskedasticity. Test against Non-nested Alternatives Construct a Comprehensive Model Davidson-Mackinnon Test Problems with non-nested test a clear winner need not emerge (reject or accept simultaneously) rejecting one does not mean the other is right difficult when the non-nested models have different dependent variables 9.2 Using Proxy Variables for Unobserved Explanatory Variables Unobserved omitted v. Proxy v. Loosely speaking, a proxy variable is something that is related to the unobserved variable that we would like to control for in our analysis. Ability & IQ Plug-in solution to the omitted variables problem When does the plug-in solution give consistent estimators? The error u is uncorrelated with x1, x2, and x3*, in addition, u is uncorrelated with x3. The error v3 is uncorrelated with x1, x2, and x3. Influence: consistent estimator of Proxy Variables: cases of Bias the average level of ability not only changes with IQ, but also with educ and exper. Biased estimator of Upward bias of proxy variable IQ Proxy Variables: Lagged Dependent V. account for historical factors that cause current differences in the dependent variable that are difficult to account for in other ways. E.g.: Crime rate & expenditure on law enforcement the main reason for putting crime-1 in the equation is that cities with high historical crime rates may spend more on crime prevention. Hardly perfect, but better Other way differentials 9.3 Properties of OLS under Measurement Error Measurement Error: use an imprecise measure of an economic v. in a regression model Marginal tax rate (average) Differences between proxy variables and measurement error Different conceptually: In the proxy variable case, looking for a v. that is somehow associated with the unobserved v. In the measurement error case, the v. that we do not observe has a well-defined, quantitative meaning, but our recorded measures of it may contain error. Different primary interests: In the proxy variable case, we are usually concerned with the effects of the other independent v. In the measurement error case, the mis-measured independent v. 只有当可搜集到数据的变量与影响个人决策的变量不同时, 测量误差才成为问题 9.3.1 Measurement Error in the Dependent Variable The bottom line is that measurement error in the dependent v. can cause biases in OLS if it is systematically related to one or more of the explanatory v.-s. If the measurement error is just a random reporting error that is independent of the explanatory v.-s, then OLS is perfectly appropriate. Measurement Error (the difference between the observed value and the actual value) The usual assumption is that the measurement error in y is statistically independent of each explanatory v. If this is true, then the OLS estimators from (9.19) are unbiased and consistent. Further, the usual OLS inference procedures (t, F, and LM statistics) are valid. (larger var. of OLS estimators) Multiplicative measurement error: 9.3.2 Measurement Error in the Independent Variables Much more important problem Maintained assumption: u is uncorrelated with x1* and x1. If: Then OLS has all of its nice properties. If: (Classical Error-in-variables, CEV) Then biased and inconsistent estimator; Attenuation Bias(衰减偏误):on average (or in large samples), the estimated OLS effect will be attenuated. If the variance of x1* is large, relative to the variance in the measurement error, then the inconsistency in OLS will be small. 多个变量时,一般的一个变量的 ME会导致所有估计量有偏、不一致 9.4 Missing Data, Nonrandom Samples and Outlying Observations Missing Data Reduce the sample size Missing at random 某些样本缺失数据的概率更大 非随机抽样 Nonrandom Samples Certain types of nonrandom sampling do not cause bias or inconsistency in OLS. sample selection based on the independent variables:Exogenous sample selection. sample selection based on the dependent variable:Endogenous sample selection. Biased and Inconsistent Outlying Observations Outlying Observations (Influential Observations) Loosely speaking, an observation is an outlier if dropping it from a regression analysis makes the OLS estimates change by a practically “large” amount. Entering mistakes; sampling from a small population if one or several members of the population are very different in some relevant aspect from the rest of the population. OLS results should probably be reported with and without outlying observations in cases where one or several data points substantially change the results. Certain functional forms are less sensitive to outlying observations. logarithmic transformation significantly narrows the range of the data and also yields functional forms that can explain a broader range of data. Outlying Observations:LAD least absolute deviations (LAD): The LAD estimator minimizes the sum of the absolute deviation of the residuals, rather than the sum of squared residuals. Compared with OLS, LAD gives less weight to large residuals. Thus, it is less influenced by changes in a small number of observations. Drawbacks: there are no formulas for the estimators LAD consistently estimates the parameters in the population regression function (the conditional mean), only when the distribution of the error term u is symmetric. if the error u is normally distributed, LAD is less efficient (asymptotically) than OLS. Robust Regression: Example 9.1 (1.1, 3.5, 5.3, 7.12, 8.3) Economic Model of Crime Economics of Crime (Gary Becker, 1968) Economic Model: choice of labor supply Econometric Functional Model: Form Misspecification? Proxy Variable? Example 9.1 (1.1, 3.5, 5.3, 7.12, 8.3) Economic Model of Crime Data: CRIME1.RAW contains data on arrests during the year 1986 and other information on 2,725 men born in either 1960 or 1961 in California. Each man in the sample was arrested at least once prior to 1986. Functional Form Misspecification? Quadratic terms? Proxy Variable? E.g. 9.4 (CRIME2.RAW) Example 9.1 (1.1, 3.5, 5.3, 7.12, 8.3) Economic Model of Crime Regression and Results reg narr86 pcnv ptime86 qemp86 avgsen(+) 问题:判刑时间越长,增加犯罪活动?(e.g. 3.5; avgsen的系数不 显著) reg narr86 pcnv ptime86 qemp86 avgsen tottime test avgsen tottime (F, LM) 二值因变量线性概率模型LPM(e.g. 7.12) gen arr86=narr86; replace arr86=1 if arr86>0 reg arr86 pcnv avgsen tottime ptime86 qemp86 (解释) Quadratic terms (显著的项增加其平方项,看其显著性) RESET predict yhat; predict resid, resid; (drop) Proxy Variable? E.g. 9.4 (CRIME2.RAW);作业9.2; 9.4; 9.3(习题9.7); References Jeffrey M. Wooldridge, Introductory Econometrics——A Modern Approach, Chap 4-7.