/* Do File to Estimate FCI-AGE Relationship in the Presence of Heteroskedasticity */ /* Import Data */ import excel "C:\Documents\Classes\Econ4230\R_and_Stata\Data\FCI.xlsx", sheet("Sheet1") firstrow /* Scatter Plot of X-Y data */ twoway (scatter FCI Age) /* OLS Regression */ regress FCI Age /* Save OLS Residuals */ predict uhat, resid /* Plot OLS Residuals vs. Age */ twoway (scatter uhat Age) /* Breusch-Pagan Het Test */ estat hettest /* OLS with Robust Standard Errors */ regress FCI Age, vce(robust) /* GLS with Var(u) Quadratic in Age */ gen ystar = FCI/Age gen invAge = 1/Age regress ystar invAge predict uhat2, resid twoway (scatter uhat2 Age) /* GLS with Var(u) Linear in Age */ gen ystar2 = FCI/sqrt(Age) gen xstar1 = 1/sqrt(Age) gen xstar2 = sqrt(Age) regress ystar2 xstar1 xstar2 predict uhat3, resid twoway (scatter uhat3 Age)