Computing a p-value for the Durbin-Watson test for Fixed Effects ModelsA discussion of the generalization of the Durbin-Watson test to testing for serial correlation in the OLS residuals from the fixed effects model is given in Bhargava, Franzini and Narendranathan [1982]. The Durbin-Watson test statistic can be expressed as: d = ê'Aê / ê'ê where ê are the OLS residuals and the A matrix is
suitably constructed for the panel data. The exact distribution of d is
calculated using the Imhof routine that computes the cumulative
distribution function for a quadratic form in normal variables.
This is implemented with the The SHAZAM commands (filename:
The SHAZAM output can be viewed.
[SHAZAM Guide home] SHAZAM output|_SAMPLE 1 20 |_READ(FIRM1.txt) YEAR IGM FGM CGM ICHR FCHR CCHR / SKIPLINES=1 UNIT 88 IS NOW ASSIGNED TO: FIRM1.txt 7 VARIABLES AND 20 OBSERVATIONS STARTING AT OBS 1 |_READ(FIRM2.txt) YEAR IGE FGE CGE IWH FWH CWH / SKIPLINES=1 UNIT 88 IS NOW ASSIGNED TO: FIRM2.txt 7 VARIABLES AND 20 OBSERVATIONS STARTING AT OBS 1 |_READ(FIRM3.txt) YEAR IUS FUS CUS / SKIPLINES=1 UNIT 88 IS NOW ASSIGNED TO: FIRM3.txt 4 VARIABLES AND 20 OBSERVATIONS STARTING AT OBS 1 |_* Stack the data |_MATRIX I=(IGM'|ICHR'|IGE'|IWH'|IUS')' |_MATRIX F=(FGM'|FCHR'|FGE'|FWH'|FUS')' |_MATRIX C=(CGM'|CCHR'|CGE'|CWH'|CUS')' |_GEN1 NC=5 |_GEN1 NT=20 |_* Create cross-section dummy variables. |_MATRIX CSDUM=SEAS(100,-NC) |_* OLS estimation with dummy variables |_SAMPLE 1 100 |_POOL I F C CSDUM / NOCONSTANT NCROSS=5 OLS HETCOV RSTAT RESID=E POOLED CROSS-SECTION TIME-SERIES ESTIMATION 100 TOTAL OBSERVATIONS 5 CROSS-SECTIONS 20 TIME-PERIODS DEPENDENT VARIABLE = I POOLING BY OLS USING PANEL-CORRECTED COVARIANCE MATRIX LM TEST FOR CROSS-SECTION HETEROSKEDASTICITY 33.468 CHI-SQUARE WITH 4 D.F. P-VALUE= 0.00000 BREUSCH-PAGAN LM TEST FOR DIAGONAL COVARIANCE MATRIX 28.322 CHI-SQUARE WITH 10 D.F. P-VALUE= 0.00160 R-SQUARE = 0.9375 VARIANCE OF THE ESTIMATE-SIGMA**2 = 4777.3 STANDARD ERROR OF THE ESTIMATE-SIGMA = 69.118 SUM OF SQUARED ERRORS-SSE= 0.44429E+06 MEAN OF DEPENDENT VARIABLE = 248.96 LOG OF THE LIKELIHOOD FUNCTION = -561.847 VARIABLE ESTIMATED STANDARD T-RATIO PARTIAL STANDARDIZED ELASTICITY NAME COEFFICIENT ERROR 93 DF P-VALUE CORR. COEFFICIENT AT MEANS F 0.10598 0.1771E-01 5.985 0.000 0.527 0.5621 0.8183 C 0.34666 0.2716E-01 12.76 0.000 0.798 0.4808 0.4331 CSDUM -76.067 74.99 -1.014 0.313-0.105 -0.1142 -0.0611 CSDUM -29.374 11.93 -2.462 0.016-0.247 -0.0441 -0.0236 CSDUM -242.17 35.36 -6.849 0.000-0.579 -0.3635 -0.1945 CSDUM -57.899 12.77 -4.534 0.000-0.425 -0.0869 -0.0465 CSDUM 92.539 39.35 2.352 0.021 0.237 0.1389 0.0743 DURBIN-WATSON = 0.7745 VON NEUMANN RATIO = 0.7823 RHO = 0.60606 RESIDUAL SUM = 0.41922E-11 RESIDUAL VARIANCE = 4777.3 SUM OF ABSOLUTE ERRORS= 4782.7 R-SQUARE BETWEEN OBSERVED AND PREDICTED = 0.9375 |_* Compute a p-value for the Durbin-Watson statistic |_GEN1 K=$K ..NOTE..CURRENT VALUE OF $K = 7.0000 |_GEN1 NOBS=100 |_MATRIX X=(F|C|CSDUM) |_MATRIX M=IDEN(NOBS)-X*INV(X'X)*X' |_* Generate the A matrix |_SAMPLE 1 NT |_GENR D=2 |_IF(TIME(0).EQ.1) D=1 |_IF(TIME(0).EQ.NT) D=1 |_MATRIX A=IDEN(NT,2) |_MATRIX A=-(A+A')+DIAG(D) |_MATRIX ASTAR=IDEN(NC)@A |_* Get the eigenvalues of MA (sorted in descending order) |_MATRIX MA=M*ASTAR |_MATRIX EDW=EIGVAL(MA) |_* Determine the number of non-zero eigenvalues. |_GEN1 DF=NOBS-K |_* Compute the DW statistic |_MATRIX DWTEST=(E'ASTAR*E)/(E'E) |_* Compute the p-value with the IMHOF routine. |_SAMPLE 1 1 |_DISTRIB DWTEST / EIGENVAL=EDW TYPE=IMHOF NEIGEN=DF CDF=PVALUE DATA CDF 1-CDF DWTEST ROW 1 0.77452 0.28982E-09 1.0000 |_PRINT DWTEST DF PVALUE DWTEST DF PVALUE 0.7745177 93.00000 0.2898198E-09 |_STOP [SHAZAM Guide home] |