SAMPLE 1 26 * Read the Griffiths, Hill and Judge (1993, p.491) wheat supply data set READ (WHEAT.txt) Q P * Generate a time index GENR T=TIME(0) * Define a variable to use as the weight variable GENR WT=0 * * STEP 1 : Separate OLS regression for the two observation subsets * First subset SAMPLE 1 13 OLS Q P T * Save the estimated error variance in the weight variable GENR WT=1/$SIG2 * Second subset SAMPLE 14 26 OLS Q P T GENR WT=1/$SIG2 * * STEP 2 : Get the weighted least squares (WLS) estimates * Griffiths, Hill and Judge (1993 p.499) - Equation (15.2.25) SAMPLE 1 26 OLS Q P T / WEIGHT=WT NONORM NOMULSIGSQ * ----------------------- comparison with OLS --------------------------- * Compare the WLS estimates with OLS - use the HETCOV option to obtain * standard errors that are adjusted for heteroskedastic errors. OLS Q P T / HETCOV STDERR=SEHET * Compare the HETCOV standard errors with the OLS standard errors. * Griffiths, Hill and Judge (1993 p.500) - Equation (15.2.29) OLS Q P T / STDERR=SEOLS * Obtain standard errors by adjusting for different error variance * in the 2 sample partitions GENR ONE=1 COPY P T ONE X GENR P=P/SQRT(WT) GENR T=T/SQRT(WT) GENR ONE=ONE/SQRT(WT) COPY P T ONE XW * Griffiths, Hill and Judge (1993 p.499) - Equation (15.2.26) MATRIX SEWLS=SQRT(DIAG(INV(X'X)*(XW'XW)*INV(X'X))) * Compare the various OLS standard errors SAMPLE 1 3 PRINT SEHET SEOLS SEWLS STOP