* R. Carter Hill, William E. Griffiths and Guay C. Lim, * Principles of Econometrics, Fourth Edition, Wiley, 2011. * Chapter 8.2.3 The Goldfeld-Quandt Test * Chapter 8.4.2 Generalized Least Squares READ (cps2.dat) / names * Estimation results for Equation (8.19) page 307. OLS wage educ exper metro * Sort the data so that the observations for the Metropolitan area * are the first group of observations. SORT metro wage educ exper / DESC * Find NM = the number of observations in the Metropolitan area STAT metro / SUMS=NM * Define a weight variable GENR WT=0 * Separate OLS regression for the two observation subsets * Metropolitan area SAMPLE 1 NM OLS wage educ exper * Save the estimated error variance in the weight variable GEN1 sigm=\$SIG2 GEN1 dfm=\$DF GENR WT=1/sigm * Outside a Metropolitan area GEN1 NM1=NM+1 SAMPLE NM1 1000 OLS wage educ exper GEN1 sigr=\$SIG2 GEN1 dfr=\$DF GENR WT=1/sigr * The Goldfeld-Quandt test statistic, page 308. GEN1 F=sigm/sigr * Get a p-value DISTRIB F / TYPE=F DF1=dfm DF2=dfr GEN1 pvalue=1-\$CDF PRINT F pvalue * Get the generalized least squares (GLS) estimates, page 315 SAMPLE 1 1000 OLS wage educ exper metro / WEIGHT=WT NONORM NOMULSIGSQ STOP