options crt limwarn=0 ; supres @covoc ; name usbalgmm "GMM Estimation of PI Matrix Models - Simple Example" ; ? ? This run illustrates the use of GMM to estimate a panel data ? model with a single independent variable. Fixed (correlated) ? firm effects whose coefficient may change over time are ? allowed for. There are 3 basic models, each estimated with no ? lags on x, and then two lags on x (3 betas): ? 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 lag coefficients ? are computed after estimating each pair of models. ? input gmmchisq ; ? Fetch gmmchisq PROC. ? input rdusbal ; ? Read in data and transform variables. ? ? Define equation for each year; only use the last 3 years, ? as a simple example. sl is the dep. var. and cl the indep. var. ? frml ueq86 sl86-beta1*cl86-beta2*cl85-beta3*cl84 ; frml ueq87 sl87-beta1*cl87-beta2*cl86-beta3*cl85 ; frml ueq88 sl88-beta1*cl88-beta2*cl87-beta3*cl86 ; ? ? This differencing transformation allows for time-varying ? coefficients on the fixed effect. ? frml dueq87 ueq87-(lam87/lam86)*ueq86 ; frml dueq88 ueq88-(lam88/lam87)*ueq87 ; ? ? Substitute ueq equations (levels) into dueq equations ? (differences). ? dot 87 88 ; eqsub dueq. ueq86-ueq88 ; enddot ; ? list sl sl86-sl88 ; list cl cl83-cl88 ; list ulist u86-u88 ; list ueqlist ueq86-ueq88 ; ? ? This model is the one discussed by Chamberlain under strict ? exogeneity. ? ? Obtain starting values for maintained model (the most general). ? const lam86 1 lam87 1 lam88 1 ; param beta1 beta2 beta3 ; gmm(silent,inst=cl) dueq87-dueq88 ; param lam88 1 ; gmm(silent,inst=cl) dueq87-dueq88 ; set lam87=lam88 ; param lam87 ; gmm(silent,inst=cl) dueq87-dueq88 ; ? ? Correlated effects with lags; time-varying coefficient. ? This is the most general model, and will be used to compute ? the covariance of (OC) for the rest of them. The trace ? reported by TSP is distributed chi-squared with degrees of ? freedom = #orthogonality constraints. ? title "Fixed Effects - Lags - Lambdas Free" ; ? gmm (silent,maxit=50,noiteru,hetero,inst=cl) dueq87-dueq88 ; gmmchisq traceu dfu ; ? title "Fixed Effects - No Lags - Lambdas Free" ; ? const beta2 0 beta3 0 ; gmm (silent,noiteru,hetero,inst=cl) dueq87-dueq88 ; gmmchisq tracec dfc ; ? title "Test for Presence of Lags" ; ? set ndf = dfc-dfu ; set lagtest = tracec-traceu ; cdf (chisq,df=ndf) lagtest ; ? title "Fixed Effects - Lags" ; ? param beta1 beta2 beta3 ; const lam88 1 lam87 1 lam86 1 ; gmm (noiteru,hetero,inst=cl,silent) dueq87-dueq88 ; gmmchisq traceu dfu ; ? title "Fixed effects - No Lags" ; ? param beta1 ; const beta2 0 beta3 0 ; const lam88 1 lam87 1 lam86 1 ; gmm(noiteru,hetero,inst=cl,silent) dueq87-dueq88 ; gmmchisq tracec dfc ; ? title "Test for Presence of Lags" ; ? set ndf = dfc-dfu ; set lagtest = tracec-traceu ; cdf (chisq,df=ndf) lagtest ; ? title "No Correlated Effects - Lags" ; ? ? Notice that a level equation (ueq86) is added when there ? are no fixed effects. ? param beta2 beta3 ; const lam88 1 lam87 1 lam86 1 ; gmm(noiteru,hetero,inst=cl,silent) ueq86 dueq87 dueq88 ; gmmchisq traceu dfu ; ? title "No Correlated Effects - No Lags" ; ? const beta2 0 beta3 0 ; const lam86 1 lam87 1 lam88 1 ; gmm(noiteru,hetero,inst=cl,silent) ueq86 dueq87 dueq88 ; gmmchisq tracec dfc ; ? title "Test for Presence of Lags" ; ? set ndf = dfc-dfu ; set lagtest = tracec-traceu ; cdf (chisq,df=ndf) lagtest ; stop ; end ;