* Load the Theil textile data set DEMO * Estimation with AR(1) errors AUTO CONSUME INCOME PRICE / ITER=2 * Forecasting FC / BLUP BEG=15 END=17 LIST * --- SHAZAM commands for AR(1) estimation and forecasting --- OLS CONSUME INCOME PRICE / RSTAT * The value of RHO is in the temporary variable $RHO GEN1 RHO=$RHO * Transform the data SAMPLE 2 17 GENR Y=CONSUME-RHO*LAG(CONSUME) GENR X1=INCOME-RHO*LAG(INCOME) GENR X2=PRICE-RHO*LAG(PRICE) GENR CONST=1-RHO * Transform the first observation SAMPLE 1 1 GEN1 R=SQRT(1-RHO*RHO) GENR Y=R*CONSUME GENR X1=R*INCOME GENR X2=R*PRICE GENR CONST=R * Use OLS with transformed data to replicate the AUTO command SAMPLE 1 17 OLS Y X1 X2 CONST / NOCONSTANT COEF=BETA * Alternative estimation method - Drop the first observation AUTO CONSUME INCOME PRICE / ITER=2 DROP * Replicate the results with OLS on the transformed observations SAMPLE 2 17 OLS Y X1 X2 CONST / NOCONSTANT * Forecasting for observations 16 and 17 OLS CONSUME INCOME PRICE / INCOEF=BETA PREDICT=YHAT RESID=E SAMPLE 16 17 GENR T=TIME(-15) GENR YBLUP = YHAT + (RHO**T)*(E:15) PRINT CONSUME YBLUP STOP