* Reference: Chapter 7 of * Ernst R. Berndt, The Practice of Econometrics, Addison-Wesley, 1991. SAMPLE 1 34 READ (NERC) YEAR KWH PELEC GNP NSF / SKIPLINES=1 * Exercise 2, p. 338. * (a) GRAPH PELEC YEAR / LINEONLY * (b) GRAPH KWH YEAR / LINEONLY GRAPH GNP YEAR / LINEONLY STAT KWH GNP / PCOR OLS KWH GNP * Restrict the sample to 1951-1973 SAMPLE 1 23 STAT KWH GNP / PCOR OLS KWH GNP * Sample 1974-1984 SAMPLE 24 34 STAT KWH GNP / PCOR OLS KWH GNP * (c) SAMPLE 1 34 GENR LNKWH=LOG(KWH) GENR LNPEL=LOG(PELEC) GENR LNGNP=LOG(GNP) GENR LAGKWH=LAG(LNKWH) GENR LAGPEL=LAG(LNPEL) GENR LAGGNP=LAG(LNGNP) GENR LNK1=LNKWH-LAGKWH GENR LNP1=LNPEL-LAGPEL GENR LNG1=LNGNP-LAGGNP * 1952-1973 SAMPLE 2 23 STAT LNP1 LNG1 LNK1 / PCOR * 1974-1984 SAMPLE 24 34 STAT LNP1 LNG1 LNK1 / PCOR * 1952-1984 SAMPLE 2 34 STAT LNP1 LNG1 LNK1 / PCOR * Exercise 5, p. 344. * Estimate the demand for electricity using Equation (7.5) SAMPLE 2 34 * The coefficients on LNP1 and LNG1 are the short-run price and * income elasticities of demand for electricity. * The DWPVALUE option reports the Durbin-Watson test statistic * and p-value. OLS LNK1 LNP1 LNG1 / LOGLOG DWPVALUE * Iterative Cochrane-Orcutt estimation. AUTO LNK1 LNP1 LNG1 / LOGLOG * Exercise 6, p. 346. * (a) Estimate the demand for electricity using Equation (7.9). SAMPLE 2 34 * The coefficients on LNPEL and LNGNP are short-run elasticities of * demand for electricity. * The DLAG option reports Durbin's h test assuming that the first * regressor is a lagged dependent variable. * Note that Durbin's h test is valid for "large" samples and * is approximate only when applied to "small" samples. OLS LNKWH LAGKWH LNPEL LNGNP / LOGLOG DLAG RSTAT RESID=R * Obtain an estimate of the partial adjustment coefficient - * reported as TEST VALUE by the TEST command. TEST 1-LAGKWH * Obtain estimates of the long-run elasticities. TEST LNPEL/(1-LAGKWH) TEST LNGNP/(1-LAGKWH) * (c) Durbin's m-statistic to test for autocorrelation. GENR LAGR=LAG(R) SAMPLE 3 34 * Run an artifical regression. OLS R LAGKWH LNPEL LNGNP LAGR * Calculate a test statistic GEN1 LM=$N*$R2 * Get a p-value DISTRIB LM / TYPE=CHI DF=1 GEN1 pval=1-$CDF PRINT LM pval * (d) Hildreth-Lu grid search estimation for models with AR(1) errors. SAMPLE 2 34 AUTO LNKWH LAGKWH LNPEL LNGNP / LOGLOG DLAG GS ML * Obtain an estimate of the partial adjustment coefficient. TEST 1-LAGKWH * (e) Iterative Cochrane-Orcutt estimation. AUTO LNKWH LAGKWH LNPEL LNGNP / LOGLOG DLAG * Exercise 8, p. 352. * (a) Restrict the sample to 1952-1973 SAMPLE 2 23 * Obtain autocorrelation functions. ARIMA LNK1 / GRAPHAC GRAPHPAC ARIMA LNP1 / GRAPHAC GRAPHPAC ARIMA LNG1 / GRAPHAC GRAPHPAC * (b) Iterative Cochrane-Orcutt estimation. AUTO LNK1 LNP1 LNG1 / LOGLOG * (c) Forecasts of LNP1 and LNG1 * Estimation for the logarithmic first differenced series. ARIMA LNP1 / NMA=1 COEF=BP GEN1 SP=SQRT($SIG2) ARIMA LNG1 / NMA=1 COEF=BG GEN1 SG=SQRT($SIG2) * Forecasting for 10 years - use the PREDICT= option to save the * forecasts. The original observations are overwritten by the * forecasts. ARIMA LNP1 / NMA=1 COEF=BP SIGMA=SP FBEG=23 FEND=33 PREDICT=LNP1 ARIMA LNG1 / NMA=1 COEF=BG SIGMA=SG FBEG=23 FEND=33 PREDICT=LNG1 * (d) Now use the FC command to forecast electricity demand. DIM YHAT 34 AUTO LNK1 LNP1 LNG1 / LOGLOG FC / LIST BEG=24 END=33 BLUP PREDICT=YHAT SAMPLE 24 33 * Get the arithmetic average of the forecasts. STAT YHAT / MEAN=AVG GEN1 AVG=100*AVG PRINT AVG STOP