Examples / HANSEN.RPF |
HANSEN.RPF does two Hansen J-tests for the consumption equation in Klein’s model I.
The first is the simplified version for two-stage least squares. The J-statistic is included in the regression output:
instruments constant trend govtwage govtexp taxes $
profit{1} capital{1} prod{1}
linreg(inst) cons / resids
# constant profit{0 1} wagebill
You can also do a form of the test by regressing the residuals from the IV estimator on the full instrument set:
linreg resids
# constant trend govtwage govtexp taxes $
profit{1} capital{1} prod{1}
cdf chisqr %trsq 4
The two test statistics are slightly different because the J-statistic produced by the first LINREG uses an estimate of the residual variance corrected for degrees of freedom.
The second uses the GMM optimal weights allowing for one lag of autocorrelation.
linreg(inst,optimal,lags=1,lwindow=newey) cons
# constant profit{0 1} wagebill
Full Program
cal(a) 1920
allocate 1941:1
open data klein.prn
data(org=columns,format=prn) / cons $
profit privwage invst klagged1 prod govtwage govtexp taxes
set wagebill = privwage+govtwage
set trend = t-1931:1
set capital = klagged1+invst
smpl 1921:1 1941:1
instruments constant trend govtwage govtexp taxes $
profit{1} capital{1} prod{1}
*
* Simple 2SLS. The test statistic will be included in the output.
*
linreg(inst) cons / resids
# constant profit{0 1} wagebill
*
* Doing the test by regressing residuals on the full instrument set.
*
linreg resids
# constant trend govtwage govtexp taxes $
profit{1} capital{1} prod{1}
cdf chisqr %trsq 4
*
* The two test statistics are slightly different because the J-statistic
* produced by the first LINREG uses a degrees of freedom corrected
* estimate of the residual variance. To get the identical result, you
* need to multiply %trsq by (%nobs-4.0)/%nobs
*
* Test with the weight matrix adjusted for serial correlation and
* heteroscedasticity. The test statistic here can't easily be computed
* except by using some set of options for LINREG
*
linreg(inst,optimal,lags=1,lwindow=newey) cons
# constant profit{0 1} wagebill
*
* This will produce the identical results to the included J-test
*
cdf chisq %uzwzu 4
Output
Linear Regression - Estimation by Instrumental Variables
Dependent Variable CONS
Annual Data From 1921:01 To 1941:01
Usable Observations 21
Degrees of Freedom 17
Mean of Dependent Variable 53.995238095
Std Error of Dependent Variable 6.860865557
Standard Error of Estimate 1.135658590
Sum of Squared Residuals 21.925247347
J-Specification(4) 7.1007
Significance Level of J 0.1306592
Durbin-Watson Statistic 1.4851
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Constant 16.554755766 1.467978697 11.27725 0.00000000
2. PROFIT 0.017302212 0.131204584 0.13187 0.89663371
3. PROFIT{1} 0.216234041 0.119221677 1.81371 0.08741342
4. WAGEBILL 0.810182698 0.044735057 18.11069 0.00000000
Linear Regression - Estimation by Least Squares
Dependent Variable RESIDS
Annual Data From 1921:01 To 1941:01
Usable Observations 21
Degrees of Freedom 13
Centered R^2 0.4176908
R-Bar^2 0.1041397
Uncentered R^2 0.4176908
Mean of Dependent Variable 0.0000000000
Std Error of Dependent Variable 1.0470254855
Standard Error of Estimate 0.9910085321
Sum of Squared Residuals 12.767272840
Regression F(7,13) 1.3321
Significance Level of F 0.3106359
Log Likelihood -24.5725
Durbin-Watson Statistic 1.6911
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Constant 5.68456967 14.35921939 0.39588 0.69861210
2. TREND 0.11742706 0.35324783 0.33242 0.74487044
3. GOVTWAGE -0.25603485 1.15028231 -0.22258 0.82731796
4. GOVTEXP -0.50438328 0.17756746 -2.84052 0.01390749
5. TAXES 0.13971148 0.19691423 0.70950 0.49054214
6. PROFIT{1} -0.18850560 0.23554552 -0.80029 0.43792167
7. CAPITAL{1} -0.04318939 0.05407402 -0.79871 0.43880824
8. PROD{1} 0.15245636 0.12809435 1.19019 0.25525404
Chi-Squared(4)= 8.771507 with Significance Level 0.06707148
Linear Regression - Estimation by GMM
Dependent Variable CONS
Annual Data From 1921:01 To 1941:01
Usable Observations 21
Degrees of Freedom 17
Mean of Dependent Variable 53.995238095
Std Error of Dependent Variable 6.860865557
Standard Error of Estimate 1.108931308
Sum of Squared Residuals 20.905386993
J-Specification(4) 3.9002
Significance Level of J 0.4196769
Durbin-Watson Statistic 1.4948
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Constant 15.130567399 1.139451747 13.27881 0.00000000
2. PROFIT 0.059849060 0.112783656 0.53065 0.59565881
3. PROFIT{1} 0.173054317 0.096878512 1.78630 0.07405031
4. WAGEBILL 0.843050181 0.040872101 20.62654 0.00000000
Chi-Squared(4)= 3.900228 with Significance Level 0.41967690
Copyright © 2024 Thomas A. Doan