A Quick Guide to SHAZAM (II)
by Walter Sosa
This quick guide presents various tests and alternative estimation methods. We will use the consumption example in the Shazam manual. As a starting point, we read the data from the file shazdat.txt and estimate a basic model. See the Quick Guide I for basic Shazam commands.
|_SAMPLE 1 17
|_READ(c:\sa\shazdat.txt) year consume income price /skiplines=1
|_PRINT year consume income price
|_STAT consume income price
|_OLS consume income price
These are some basic results of the OLS estimation:
R-SQUARE = 0.9516 R-SQUARE ADJUSTED = 0.9447
VARIANCE OF THE ESTIMATE-SIGMA**2 = 30.716
STANDARD ERROR OF THE ESTIMATE-SIGMA = 5.5422
SUM OF SQUARED ERRORS-SSE= 430.03
MEAN OF DEPENDENT VARIABLE = 134.49
LOG OF THE LIKELIHOOD FUNCTION = -51.5823
VARIABLE ESTIMATED STANDARD T-RATIO PARTIAL STANDARDIZED ELAST.
NAME COEFFICIENT ERROR 14 DF P-VALUE CORR. COEFFICIENT AT MEANS
INCOME 1.0648 0.2668 3.991 0.999 0.730 0.2388 0.8155
PRICE -1.3846 0.8358E-01 -16.57 0.000-0.975 -0.9909 -0.7856
CONSTANT 130.48 27.07 4.819 1.000 0.790 0.0000 0.9701
1. Testing hypothesis on regression coefficients
We start by testing the simple hypothesis that the coefficient associated with income is equal to 1. The TEST command is used:
|_TEST income = 1
And some relevant output is:
TEST VALUE = 0.64824E-01 STD. ERROR OF TEST VALUE 0.26678
T STATISTIC = 0.24298353 WITH 14 D.F. P-VALUE= 0.40577
F STATISTIC = 0.59040995E-01 WITH 1 AND 14 D.F. P-VALUE= 0.81154
WALD CHI-SQUARE STATISTIC = 0.59040997E-01 WITH 1 D.F. P-VALUE= 0.80802
UPPER BOUND ON P-VALUE BY CHEBYCHEV INEQUALITY = 1.00000
Test value is simply income-1. The t-statistic is the usual t-ratio. The command also performs an F-statistic and an asymptotic wald statistic . Now test the hypothesis that the price coefficient is equal to -1:
|_TEST price = -1
Suppose we want to test the non-linear hypothesis that the product of the income and price coefficients is one. This is performed with:
|_TEST income*price=1
and the output is:
TEST VALUE = -2.4743 STD. ERROR OF TEST VALUE 0.39558
T STATISTIC = -6.2548234 WITH 14 D.F. P-VALUE= 0.00001
F STATISTIC = 39.122816 WITH 1 AND 14 D.F. P-VALUE= 0.00002
WALD CHI-SQUARE STATISTIC = 39.122814 WITH 1 D.F. P-VALUE= 0.00000
UPPER BOUND ON P-VALUE BY CHEBYCHEV INEQUALITY = 0.02556
Again, the test value is income*price -1. The standard error is obtained from the "delta-method". The "t-statistic" does not have the t-distribution but the standard normal. Note that the t-statistic is the square root of the Wald statistic, which in our case has Chi-Square distribution with one degree of freedom. The previous were single hypothesis. To test the joint hypothesis that the coefficients of income and price are 1 and -1 jointly we use:
|_TEST
|_TEST income =1
|_TEST price=-1
|_END
obtaining:
F STATISTIC = 10.773871 WITH 2 AND 14 D.F. P-VALUE= 0.00147
WALD CHI-SQUARE STATISTIC = 21.547743 WITH 2 D.F. P-VALUE= 0.00002
The command performs an F-statistic and a Wald test of the joint hypothesis.
2. Residual analysis. Testing for normality
If you include the options RSTAT , GF and LM, the OLS command willl produce an analysis of the residuals and a goodness of fit test for normality of the residuals. GS produces a goodness of fit test and LM produces Jarque and Bera's test of normality
OLS consume income price / RSTAT GF LM
and some relevant output is:
DURBIN-WATSON = 2.0291 VON NEUMANN RATIO = 2.1560 RHO = -0.19231 RESIDUAL SUM = 0.66791E-12 RESIDUAL VARIANCE = 30.716 SUM OF ABSOLUTE ERRORS= 72.335 R-SQUARE BETWEEN OBSERVED AND PREDICTED = 0.9516 RUNS TEST: 7 RUNS, 9 POSITIVE, 8 NEGATIVE, NORMAL STATISTIC = -1.2423 COEFFICIENT OF SKEWNESS = -0.0273 WITH STANDARD DEVIATION OF 0.5497 COEFFICIENT OF EXCESS KURTOSIS = -0.8459 WITH STANDARD DEVIATION OF 1.0632
GOODNESS OF FIT TEST FOR NORMALITY OF RESIDUALS - 6 GROUPS OBSERVED 0.0 2.0 6.0 6.0 3.0 0.0 EXPECTED 0.4 2.3 5.8 5.8 2.3 0.4 CHI-SQUARE = 1.0363 WITH 1 DEGREES OF FREEDOM
JARQUE-BERA ASYMPTOTIC LM NORMALITY TEST CHI-SQUARE = 0.6412 WITH 2 DEGREES OF FREEDOM TYPE COMMAND
3. Testing for autocorrelation and heteroskedasticity
The command DIAGNOS performs several specification tests on the last estimated model. To test for the presence of serial correlation in the residuals we use the ACF option (ACF stands for Autocorrelation Function):
|_DIAGNOS /ACF
Some relevant output is:
RESIDUAL CORRELOGRAM
LM-TEST FOR HJ:RHO(J)=0, STATISTIC IS STANDARD NORMAL
LAG RHO STD ERR T-STAT LM-STAT DW-TEST BOX-PIERCE-LJUNG
1 -0.1531 0.2425 -0.6311 0.7385 2.0291 0.4729
2 -0.2221 0.2425 -0.9158 1.2245 2.0313 1.5352
3 0.1923 0.2425 0.7928 1.0255 1.1821 2.3883
4 -0.2940 0.2425 -1.2123 1.7086 1.9974 4.5364
LM CHI-SQUARE STATISTIC WITH 4 D.F. IS 3.335
By default this command produces estimates of the autocorrelation function for 4 lags. The RHO coefficients are total autocorrelations of the residuals with respect to its lags. The command also produces a Breusch-Pagan LM test for serial correlation of order 4.
To test for the presence of heteroskedastic residuals we use the HET option:
|_DIAGNOS /HET
HETEROSKEDASTICITY TESTS
E**2 ON YHAT: CHI-SQUARE = 2.458 WITH 1 D.F.
E**2 ON YHAT**2: CHI-SQUARE = 2.626 WITH 1 D.F.
E**2 ON LOG(YHAT**2): CHI-SQUARE = 2.263 WITH 1 D.F.
E**2 ON X (B-P-G) TEST: CHI-SQUARE = 4.934 WITH 2 D.F.
E**2 ON LAG(E**2) ARCH TEST: CHI-SQUARE = 1.576 WITH 1 D.F.
LOG(E**2) ON X (HARVEY) TEST: CHI-SQUARE = 3.533 WITH 2 D.F.
ABS(E) ON X (GLEJSER) TEST: CHI-SQUARE = 4.308 WITH 2 D.F.
This command computes several heteroskedasticity tests including Breush-Godfrey and ARCH tests
4. Robust regression
Robust alternatives to OLS are easily produced in Shazam. The following command produces estimates based on the Least Absolute Errors (LAE) criterion. The RSTAT option prints summary statistics of the residuals of the estimation:
|_ROBUST consume income price /LAE RSTAT
LEAST ABSOLUTE ERRORS REGRESSION
OBJECTIVE FUNCTION = 35.039
NUMBER OF SIMPLEX ITERATIONS = 6.0000
EMPIRICAL QUANTILE FUNCTION AT MEANS = 136.26
SUM OF ABSOLUTE ERRORS = 70.078
USING DIFF= 2 FOR COVARIANCE CALCULATIONS
VARIANCE OF THE ESTIMATE-SIGMA**2 = 68.326
STANDARD ERROR OF THE ESTIMATE-SIGMA = 8.2659
SUM OF SQUARED ERRORS-SSE= 569.00
MEAN OF DEPENDENT VARIABLE = 134.49
VARIABLE ESTIMATED STANDARD T-RATIO PARTIAL STANDARDIZED ELASTICITY
NAME COEFFICIENT ERROR 14 DF P-VALUE CORR. COEFFICIENT AT MEANS
INCOME 0.69851 0.3979 1.756 0.949 0.425 0.1566 0.5349
PRICE -1.4421 0.1247 -11.57 0.000-0.951 -1.0321 -0.8183
CONSTANT 174.36 40.38 4.318 1.000 0.756 0.0000 1.2964
DURBIN-WATSON = 1.5357 VON NEUMANN RATIO = 1.6317 RHO = 0.19828
RESIDUAL SUM = -29.972 RESIDUAL VARIANCE = 40.643
SUM OF ABSOLUTE ERRORS= 70.078
R-SQUARE BETWEEN OBSERVED AND PREDICTED = 0.9438
RUNS TEST: 7 RUNS, 10 POSITIVE, 7 NEGATIVE, NORMAL STATISTIC = -1.1583
5. Autocorrelation models
The following command estimates the original model using the Cochrane-Orcutt iterative procedure for errors with first-order serial correlation. Again, the RSTAT option generates summary statistics on the residuals:
|_AUTO consume income price /RSTAT
LOG L.F. = -51.3037 AT RHO = -0.20585
ASYMPTOTIC ASYMPTOTIC ASYMPTOTIC
ESTIMATE VARIANCE ST.ERROR T-RATIO
RHO -0.20585 0.05633 0.23734 -0.86730
R-SQUARE = 0.9533 R-SQUARE ADJUSTED = 0.9466
VARIANCE OF THE ESTIMATE-SIGMA**2 = 29.650
STANDARD ERROR OF THE ESTIMATE-SIGMA = 5.4452
SUM OF SQUARED ERRORS-SSE= 415.10
MEAN OF DEPENDENT VARIABLE = 134.49
LOG OF THE LIKELIHOOD FUNCTION = -51.3037
VARIABLE ESTIMATED STANDARD T-RATIO PARTIAL STANDARDIZED ELASTICITY
NAME COEFFICIENT ERROR 14 DF P-VALUE CORR. COEFFICIENT AT MEANS
INCOME 1.0691 0.2264 4.723 1.000 0.784 0.2397 0.8187
PRICE -1.3766 0.7022E-01 -19.60 0.000-0.982 -0.9852 -0.7811
CONSTANT 129.28 22.83 5.663 1.000 0.834 0.0000 0.9612
DURBIN-WATSON = 1.8606 VON NEUMANN RATIO = 1.9768 RHO = -0.05771
RESIDUAL SUM = 1.1487 RESIDUAL VARIANCE = 29.744
SUM OF ABSOLUTE ERRORS= 72.685
R-SQUARE BETWEEN OBSERVED AND PREDICTED = 0.9532
RUNS TEST: 7 RUNS, 9 POSITIVE, 8 NEGATIVE, NORMAL STATISTIC = -1.2423
DURBIN H STATISTIC (ASYMPTOTIC NORMAL) = -1.1559
The GS option uses a "grid search" method to estimate the autocorrelation coefficient:
|_AUTO consume income price /gs RSTAT
and the ML option produces maximum-likelihood estimates
|_AUTO consume income price /ml RSTAT
6. Where to find more information
- There is a Quick Guide to Shazam with basic commands
- At UIUC, The Shazam User's Reference Manual v.7.0 can be purchased at the Resource Center at CCSO (1420 Digital Computer Lab). The manual contains detailed descriptions of all available commands.
- The Econometrics Lab at the UIUC Department of Economics keeps useful information related to econometric computing in general (including this guide).
Back to the Econometrics Lab page.


雷达卡
京公网安备 11010802022788号







