options crt memory=100 ; ? ================================================== ? [Dynamic Panel Data Estimation] ? [Using GMM(DIF) or GMM (SYS)] ? [without Time Dummies or with Time Dummies] ? ================================================== ? We can select the options to estimate ? dynamic panel data model in different modes. ? ================================================== ? Designed by Yoshitsugu Kitazawa ? First Design: 2003.12.28 Last Update: 2003.12.28 ? E-mail: kitazawa@ip.kyusan-u.ac.jp ? ================================================== ? ** This script realizes almost the same results ? ** as Ox version DPD except for the serial correlation ? ** tests. ? ** This script is written on the accumulation of ? ** the past technical supports by ? ** Professor Bronwyn Hall and Dr. Clint Cummins. ? ================================================== ? * T: All time periods used for the estimation ? * N: Number of individuals ? * t = 1 to T and i = 1 to N ? ? * Estimation Model without and with Time Dummy ? For all i (individual) and t (time), ? y_{it} = alp * y_{i,t-1} + u_{it} ? and ? u_{it} = eta_i + v_{it} ? where y_{it} is the dependent variable, ? alp and beta are the ? parameter of interest to be estimated, eta_i is ? the fixed effect (the nuisance parameter), and ? v_{it} is the disturbance. In this model, ? E[eta_i x_{it}] =\ 0 for all T, and x_{it} is ? endogenously determined so that E[v_{it} x_{is}]=0 ? for s=1 to t-1. ? Further, it is supposed that y_{it} and x_{it} are ? mean-stationary. ? Detailed explanation on eta_i and v_{it} is shown ? in Blundell and Bond (1998). ? ? * Specify the options at Specification of Options below. ? lt: nnumber of all time periods used in the ? estimation in this case. ? ? * Specify the options at Specification of Options below. ? [1] tm=0 and om=1 : without Time Dummies and using GMM(DIF) ? [2] tm=0 and om=2 : without Time Dummies and using GMM(SYS) ? [3] tm=1 and om=1 : with Time Dummies and using GMM(DIF) ? [4] tm=1 and om=2 : with Time Dummies and using GMM(SYS) ? ? * References ? Arellano (2003): "Panel Data Econometrics", Oxford ? University Press, Great Britain. ? Arellano and Bond (1991): "Some test of specification ? for panel data: Monte Carlo evidence and an application ? to employment equations", Review of Economic Studies, ? 58, 277-297. ? Arellano and Bover (1995): "Another look at the ? instrumental variables estimation of error-components ? models", Journal of Econometrics, 68, 29-51. ? Blundell and Bond (1998): "Initial conditions and ? moment restrictions in dynamic panel data models", ? Journal of Econometrics, 87, 115-143. ? Doornik, Arellano, and Bond (2002): "Panel Data ? estimation using DPD for Ox", ? http://www.nuff.ox.ac.uk/Users/Doornik/papers/dpd.pdf ? ? * See on detail ? http://www.ip.kyusan-u.ac.jp/J/keizai/kitazawa/SOFT/TSP_DPD1/index.htm ? ===================================================== ? [Basic Statistics from Monte Carlo experiments] ? ----------------------------------------------------- ? ecm_x : Monte Carlo mean of estimated alp ? edm_x : Monte Carlo standard deviation of estimated alp ? eem_x : Monte Carlo Mean of estimated standard errors of alp ? sgn_x : Monte Carlo Mean of Sargan test statistic ? df_x : Degree of Freedom ? ----------------------------------------------------- ? On the one-step estimator for GMM (DIF) if x = d1. ? On the two-step estimator for GMM (DIF) if x = d2. ? On the one-step estimator for GMM (SYS) if x = s1. ? On the two-step estimator for GMM (SYS) if x = s2. ? ===================================================== input "st3_dgp.tsp" ; input "cov1spdm.tsp" ; input "cov1ssys.tsp" ; input "cov2stpm.tsp" ; input "evdgen.tsp" ; input "mattrim1.tsp" ; ? ===== Specification of Options =================== ? -------------------------------------------------- ? *** Example of parameter settings in tmpprm.tsp ? -------------------------------------------------- ? * True value of alp ? set alpha = 0.7 ; ? * Variance of the fixed effect ? set s2_eta = 1 ; ? * Variance of the disturbance ? set s2_v = 1 ; ? * Number of replications for Monte Carlo experiments ? set ntrial = 500 ; ? * Number of cross-sectional observations ? set nob = 100 ; ? * Number of all time periods used in the estimation ? set lt = 7 ; ? ================================================== input "tmpprm.tsp" ; set ltm1 = lt - 1 ; set ltm2 = lt - 2 ; ? Level Eq. list(first=2, last=lt) tmplis ; dot(index=i) tmplis ; set i=i+1 ; frml ux. y. - ( alp * y_m1 ) ; set j=i-1 ; list(first=j, last=j) jlis ; dot jlis ; frml y_m1 y. ; enddot ; eqsub(print) ux. y_m1 ; enddot ; ? Differenced Eq. list(first=3, last=lt) tmplis ; dot(index=i) tmplis ; set i=i+2 ; frml dux. ux. - ux_m1 ; set j=i-1 ; list(first=j, last=j) jlis ; dot jlis ; frml ux_m1 ux. ; eqsub ux_m1 ux. ; enddot ; eqsub(print) dux. ux. ux_m1 ; enddot ; title "Equations used for the estimations" ; title "First Differenced Equations" ; list(first=3, last=lt) tmplis ; dot tmplis ; frml du. dux. ; eqsub(print) du. dux. ; enddot ; title "Level Equations" ; list(first=3, last=lt) tmplis ; dot tmplis ; frml u. ux. ; eqsub(print) u. ux. ; enddot ; ? stop ; list(first=lt, last=lt) tmplis ; dot tmplis ; list eqlisa du3-du. ; list eqlisb u3-u. ; enddot ; list(first=ltm2, last=ltm2) tmplis ; dot tmplis ; list insta y1-y. ; enddot ; list(first=ltm1, last=ltm1) tmplis ; dot tmplis ; list instb dy2-dy. ; enddot ; mform(type=triang, ncol=ltm2) one22ut = 1 ; mat one22id = ident(ltm2) ; mform(type=sym, ncol=ltm2) zer22 = 0 ; mform(nrow=1, ncol=ltm2) zer12 = 0 ; mat zer12t = zer12' ; mmake(vert) zma one22ut ; mmake(vert) zmap one22ut zer22 ; mmake(vert) zmbp zer22 one22id ; list eql_ab eqlisa ; list zl_ab insta ; mmake zm_ab zma ; list eql_bb eqlisa eqlisb ; list zl_bb insta instb ; mmake zm_bb zmap zmbp ; title "Mask Matrix for GMM (DIF)" ; print zm_ab ; title "Mask Matrix for GMM (SYS)" ; print zm_bb ; list estlis d1 d2 s1 s2 ; dot estlis ; mform(nrow=1, ncol=1) ecm_. = 0 ; mform(nrow=1, type=sym) edm_. = 0 ; mform(nrow=1, type=sym) eem_. = 0 ; set sgn_. = 0 ; set df_. = 0 ; enddot ; freq n ; smpl 1 nob ; random (seed=342) junk ; do trial = 1, ntrial ; ? smpl 1 nob ; st3_dgp ? *** PROCEDURE of DGP *********** alpha ? * the coefficient parameters (I) s2_eta ? * in individual effect (I) s2_v ? * in disturbance (I) lt ? * DGP periods (I) ymatrix ? * panel data of "y" (O) ; list(first=lt, last=lt) tmplis ; dot tmplis ; unmake ymatrix y1-y. ; enddot ; ? print y1-y6 ; ? print x1-x6 ; genr y_lag1 = y1 ; list(first=2, last=lt) tmplis ; dot tmplis ; genr dy. = y. - y_lag1 ; genr y_lag1 = y. ; enddot ; dot (index=md) estlis ; if(md=1 .or. md=2) ; then ; do ; list eqlis eql_ab ; list zlis zl_ab ; mmake zmask zm_ab ; enddo ; if(md=3 .or. md=4) ; then ; do ; list eqlis eql_bb ; list zlis zl_bb ; mmake zmask zm_bb ; enddo ; if(md=1) ; then ; do ; ? title "GMM(DIF): " ; mat neqx = ncol(zmask) ; cov1spdm neqx zlis zmask ani1 ; mat ani1 = ani1 / 2 ; param alp 0.1 ; gmm(covoc=ani1, noiteroc, nooptcov, hetero, nma=0, silent, inst=zlis, mask=zmask) eqlis ; ? print alp ; evdgen sr1 ; set sargan = @gmmovid / sr1 ; enddo ; if(md=2) ; then ; do ; ? title "GMM(DIF): " ; regopt(noprint) all ; cov2stpm eqlis zlis zmask ani2 ; regopt ; param alp 0.1 ; gmm(covoc=ani2, noiteroc, optcov, hetero, nma=0, silent, inst=zlis, mask=zmask) eqlis ; ? print alp ; set sargan = @gmmovid ; enddo ; if(md=3) ; then ; do ; ? title "GMM(SYS): " ; mat neqx = ncol(zmask) ; cov1ssys neqx zlis zmask ani1 ; mat ani1 = ani1 / 2 ; param alp 0.1 ; gmm(covoc=ani1, noiteroc, nooptcov, hetero, nma=0, silent, inst=zlis, mask=zmask) eqlis ; ? print alp ; copy @res restmp ; mat lc = ncol(@res) ; set hc = lc / 2 + 1 ; mattrim1 @res hc lc @res ; evdgen sr1 ; copy restmp @res ; set sargan = @gmmovid / sr1 ; enddo ; if(md=4) ; then ; do ; ? title "GMM(SYS): " ; regopt(noprint) all ; cov2stpm eqlis zlis zmask ani2 ; regopt ; param alp 0.1 ; gmm(covoc=ani2, noiteroc, optcov, hetero, nma=0, silent, inst=zlis, mask=zmask) eqlis ; ? print alp ; set sargan = @gmmovid ; enddo ; mat ecm_. = @coef + ecm_. ; mat edm_. = @coef * @coef' + edm_. ; mat eem_. = @ses + eem_. ; set sgn_. = sargan + sgn_. ; set df_. = @novid + df_. ; enddot ; enddo ; title "Parameter values in Monte Carlo experiments" ; print ntrial lt ; print s2_eta s2_v ; print nob alpha ; dot (index=md) estlis ; if(md=1) ; then ; do ; title "GMM(DIF): " ; enddo ; if(md=2) ; then ; do ; title "GMM(DIF): " ; enddo ; if(md=3) ; then ; do ; title "GMM(SYS): " ; enddo ; if(md=4) ; then ; do ; title "GMM(SYS): " ; enddo ; mat ecm_. = ecm_. / ntrial ; mat edm_. = (edm_. / ntrial - ecm_. * ecm_.')**(1/2) ; mat eem_. = eem_. / ntrial ; set sgn_. = sgn_. / ntrial ; set df_. = df_. / ntrial ; print ecm_. ; print edm_. ; print eem_. ; print sgn_. ; print df_. ; enddot ; stop ; end ;