* Chapter 14 - Models for Panel Data * W.H. Greene, Econometric Analysis, Fourth Edition, 2000. SAMPLE 1 90 READ (airline.shd) / NAMES * Example 14.4 - Random Effects Models GENR LC=LOG(C) GENR LQ=LOG(Q) GENR LPF=LOG(PF) * Fixed effects regression POOL LC LQ LPF LF / NCROSS=6 OLS FIXED COEF=BFE COV=VFE * The residual variance estimate from the LSDV regression, * (see result at bottom of page 573). GEN1 SIG2E=$SIG2 GEN1 NC=6 GEN1 T=15 MATRIX MLC=VEC(LC,T) MATRIX MLQ=VEC(LQ,T) MATRIX MLPF=VEC(LPF,T) MATRIX MLF=VEC(LF,T) SAMPLE 1 T SET NOOUTPUT NODOECHO STAT MLC / MEAN=YBAR STAT MLQ / MEAN=X1BAR STAT MLPF / MEAN=X2BAR STAT MLF / MEAN=X3BAR SAMPLE 1 NC OLS YBAR X1BAR X2BAR X3BAR GEN1 SIG21=$SIG2*T * Residual variance estimate for Equation (14-32), page 571. GEN1 SIG2U=$SIG2-SIG2E/T * Check that SIG2U is positive (see results at top of page 574). PRINT SIG2U GEN1 THETA=1-SQRT(SIG2E)/SQRT(SIG21) PRINT THETA * Now transform the observations using Equation (14-22), page 569. GEN1 SIGE=SQRT(SIG2E) GEN1 END=0 DO #=1,NC GEN1 BEG=END+1 GEN1 END=BEG+T-1 SAMPLE BEG END GENR LC=(LC-THETA*YBAR:#)/SIGE GENR LQ=(LQ-THETA*X1BAR:#)/SIGE GENR LPF=(LPF-THETA*X2BAR:#)/SIGE GENR LF=(LF-THETA*X3BAR:#)/SIGE ENDO SET OUTPUT SAMPLE 1 90 GENR INTERCEP=(1-THETA)/SIGE * Apply OLS to the transformed observations to get the GLS estimator * (see results in Table 14.2, "Firm Effects - Random Effects"). OLS LC LQ LPF LF INTERCEP / NOCONSTANT COEF=BRE COV=VRE * Example 14.5 - Hausman test * Extract the part of the covariance matrix that corresponds to the * slopes. MATRIX VRE3=SYM(VRE(1;3,1;3)) * Print the two estimated covariance matrices * (see results on page 577). * Note that the estimated covariance matrix for the random effects * model (VRE3) shows some numerical differences compared to the * results reported in Greene. FORMAT(3F12.7) PRINT VFE VRE3 / FORMAT * Calculate the Wald test statistic SAMPLE 1 3 GENR BFE3=BFE GENR BRE3=BRE FORMAT(3F12.5) PRINT BFE3 BRE3 / BYVAR FORMAT MATRIX Vdiff=VFE-VRE3 MATRIX SIGINV=INV(Vdiff) MATRIX W=(BFE3-BRE3)'*SIGINV*(BFE3-BRE3) * Get a p-value DISTRIB W / TYPE=CHI DF=3 GEN1 PVAL=1-$CDF PRINT W PVAL * The test statistic is calculated as 2.124706. * Greene reports 3.25. * The reason for the numerical differences is not clear -- but * both results lead to the same conclusion. * That is, the null hypothesis is not rejected. STOP