* W.H. Greene, Econometric Analysis, Fourth Edition, 2000.
SAMPLE 1 15
* Table A6.2
READ (invest.shd) / NAMES
* Allocate space for variables for use in a later prediction exercise.
DIM Y 16 T 16 G 16 R 16 P 16
* Chapter 6 - Examples 6.8, 6.12, 6.14, 6.17, 6.18
* Data transformations, p. 226.
* Generate a time trend
GENR T=TIME(0)
* Real GNP
GENR G=100*GNP/CPI
* Real Investment
GENR Y=100*INVEST/CPI
* Scale the data to measure in trillions of dollars
GENR G=G/1000
GENR Y=Y/1000
* Inflation rate
GENR P=100*(CPI-LAG(CPI))/LAG(CPI)
GENR R=INTEREST
* From Table 6.2, p. 227 the inflation rate is 4.4 in year 1
GEN1 P:1=4.40
* Now round the numbers to reproduce the data in Table 6.2.
* See the footnote at the bottom of Table 6.2, p. 227 for
* a comment on rounding error.
GENR Y=INT(Y*1000+0.49)/1000
GENR G=INT(G*1000+0.49)/1000
GENR R=INT(R*100+0.49)/100
GENR P=INT(P*100+0.49)/100
GEN1 Y:8=0.163
* Print the data in Table 6.2, p. 227
NAMEFMT(5X,5(2X,A8))
FORMAT(F10.3,F10.0,F10.3,2F10.2)
PRINT Y T G R P / FORMAT
* Summary statistics
STAT Y T G / PCPDEV
* The PCPDEV option lists the cross-products for the variables
* measured as deviations from sample means as reported on p. 228.
* OLS parameter estimates are on p. 228.
OLS Y T G
* OLS estimation on pp. 229 and 250.
OLS Y T G R P / ANOVA PCOV
* The ANOVA option reports the results in Table 6.5, p. 239
* in the SHAZAM output labelled: ANALYSIS OF VARIANCE - FROM MEAN
* This section of the output also reports the F-test for the
* overall significance of the regression - see Example 6.18, p. 254.
* The PCOV option lists the estimated covariances of the
* least squares estimators - see Table 6.6, p. 250.
* Example 6.17 - Confidence interval for the error variance, p. 253.
CONFID $SIG2
* The lower and upper limits of the 95% confidence interval are
* reported on the SHAZAM output as LOWER 2.5% and UPPER 2.5%
* respectively.
* Chapter 7
* Example 7.1 pp. 273-274
* The TEST command is used for hypothesis testing following
* model estimation. On the TEST command the variable names
* represent coefficients.
OLS Y T G R P
TEST R+P=0
* Example 7.3 - a joint hypothesis test, p. 276
TEST
TEST T=0
TEST G=1
TEST R+P=0
END
* Example 7.4 - Joint Confidence Region, pp. 277-278.
CONFID G T / GRAPH
* Example 7.2, p. 274.
GENR RR=R-P
OLS Y T G RR P
* Example 7.17 - Prediction, p. 307.
GEN1 T:16=16
GEN1 G:16=1.5
GEN1 R:16=10
GEN1 P:16=4
DIM Y0 16 FCSE 16
OLS Y T G R P
FC / LIST BEG=16 END=16 PREDICT=Y0 FCSE=FCSE
* Note: for out of sample forecasts the calculated residuals
* and forecast diagnostics printed on the SHAZAM output have no
* meaningful interpretation.
* Calculate a 95% confidence interval for the forecast.
GEN1 DF=$DF
GEN1 ALPHA=0.025
SAMPLE 1 1
DISTRIB ALPHA / TYPE=T DF=DF INVERSE CRITICAL=TCRIT
SAMPLE 16 16
GENR YLOW=Y0-TCRIT*FCSE
GENR YUP=Y0+TCRIT*FCSE
* Print the forecast interval
PRINT YLOW Y0 YUP
* Example 7.18
* Investment forecast with GNP
DIM YG 15
SAMPLE 1 15
OLS Y T G R P
FC / LIST PREDICT=YG
* The forecast performance measures are reported as follows:
* RMSE - ROOT MEAN SQUARE ERROR
* MAE - MEAN ABSOLUTE ERROR
* U_delta - THEIL INEQUALITY COEFFICIENT U
* (see formula at top of p. 311.)
* Investment forecast without GNP
OLS Y T R P
FC / LIST PREDICT=Y0
* Print the results in Table 7.6, p. 311
FORMAT(F10.0,3F10.3)
PRINT YEAR Y YG Y0 / FORMAT
* Figure 7.6, p. 312
GRAPH Y YG Y0 YEAR / LINEONLY
STOP