options crt limwarn=0 ; supres @covoc ; name usbalme "GMM Estimation of Pi Matrix Models - US Balanced Panel" ; ? ? This run illustrates the use of GMM to estimate a panel data ? model with a single independent variable which is measured ? with serially uncorrelated error. Fixed (correlated) ? firm effects whose coefficient may change over time are ? allowed for. There are 3 basic models, each estimated with ? and without measurement error. ? ? 1) No fixed effects, just y(t) = b*x(t) + u(t) ? 2) Fixed effects, the projection of alpha(i) on the ? x's from all 6 years (1983-1988). ? 3) Fixed effects with time-varying coefficients ? lambda(t). ? ? The models are estimated in reverse order, since the covariance ? matrix of the orthogonality conditions for the most general ? model must be used as a weighting matrix in GMM for all the ? models if a consistent set of test-statistics is to be ? computed. ? Chi-squared tests for the presence of measurement error ? are computed after estimating each pair of models. ? ? Reference is Griliches and Hausman (Journal of Econometrics 86). ? input gmmchisq ; ? Fetch gmmchisq PROC. ? input rdusbal ; ? Read data and transform variables. ? ? Define equation for each year; only use the last 3 years, ? as a simple example. ? frml ueq86 sl86-beta1*cl86 ; frml ueq87 sl87-beta1*cl87 ; frml ueq88 sl88-beta1*cl88 ; ? ? This differencing transformation allows for time-varying ? coefficients on the fixed effect. ? frml dueq87 ueq87-(lam87/lam86)*ueq86 ; frml dueq88 ueq88-(lam88/lam87)*ueq87 ; ? ? This equation provides additional information under the ? measurement error model, although it is redundant if there is ? no measurement error (see Griliches-Hausman, JE 1986). ? frml d2ueq88 -ueq88+(lam88/lam86)*ueq86 ; ? ? Substitute the ueq (level equations) into the d2ueq ? (difference equations). ? dot 87 88 ; eqsub dueq. ueq86-ueq88 ; enddot ; eqsub d2ueq88 ueq86-ueq88 ; ? list sl sl86-sl88 ; list cl cl83-cl88 ; list ulist u86-u88 ; list ueqlist ueq86-ueq88 ; ? ? Model with serially uncorrelated measurement error only. ? load (nrow=6,ncol=3) memask ; ? Mask for inst. if meas. ? error but no FE. 1 1 1 ? x83 inst for all equations. 1 1 1 ? x84 inst for all equations. 1 1 1 ? x85 inst for all equations. 0 1 1 ? x86 inst for u87,u88 equations. 1 0 1 ? x87 inst for u86,u88 equations. 1 1 0 ; ? x88 inst for u86,u87 equations. ? Note: comments for mask improved 11/2002 print memask ; param beta1 ; title "Levels - Measurement Error" ; gmm(silent,hetero,inst=cl,mask=memask) ueq86 ueq87 ueq88 ; gmmchisq traceu dfu ; ? ? Model with no measurement error. ? title "Levels - No Meas. Error" ; gmm(noiteru,hetero,inst=cl,silent) ueq86 ueq87 ueq88 ; gmmchisq tracec dfc ; ? title "Test for Measurement Error" ; ? set df = dfc-dfu ; set chisqme = tracec-traceu ; cdf(chisq,df=df) chisqme ; ? ? Model with serially uncorrelated measurement error and ? Fixed Effects. ? load (nrow=6,ncol=3) mefe ;? Mask for inst. if meas. error and FE. 1 1 1 1 1 1 1 1 1 0 1 0 ? x86 as inst for u88-u87 equation. 0 0 1 ? x87 as inst for u88-u86 equation. 1 0 0 ; ? x88 as inst for u87-u86 equation. ? Note: mask values corrected and comments for mask improved 11/2002 print mefe ; param beta1 ; const lam86 1 lam87 1 lam88 1 ; title "Fixed Effects and Measurement Error" ; gmm(silent,hetero,inst=cl,mask=mefe) dueq87 dueq88 d2ueq88 ; gmmchisq traceu dfu ; ? ? Model with Fixed Effects - no measurement error. ? title "Fixed Effects - No Meas. Error" ; gmm(noiteru,hetero,inst=cl,silent) dueq87 dueq88 d2ueq88 ; gmmchisq tracec dfc ; ? title "Test for Measurement Error" ; ? set df = dfc-dfu ; set chisqme = tracec-traceu ; cdf(chisq,df=df) chisqme ; ? ? Check estimator without second differenced equation. ? Gives the same answer in this case (the extra equation adds ? no new information. ? gmm(noiteru,hetero,inst=cl,silent) dueq87 dueq88 ; gmmchisq trace2 df2 ; ? ? Estimate with second differences only (another kind ? of specification test for measurement error). Should be ? the same as previous estimate if no measurement error. ? gmm(noiteru,hetero,inst=cl,silent) d2ueq88 ; gmmchisq trace1 df1 ; ? ? Lambdas free. ? param beta1 ; const lam86 1 ; param lam87 1 lam88 1 ; title "Lambdas Free - Meas. Error" ; gmm(hetero,inst=cl,mask=mefe,silent) dueq87 dueq88 d2ueq88 ; gmmchisq traceu dfu ; ? ? Model with Lambdas Free - no measurement error. ? title "Lambdas Free - No Meas. Error" ; gmm(noiteru,hetero,inst=cl,silent) dueq87 dueq88 d2ueq88 ; gmmchisq tracec dfc ; ? title "Test for Measurement Error" ; ? set df = dfc-dfu ; set chisqme = tracec-traceu ; cdf(chisq,df=df) chisqme ;