9.0 ECOMP Command The ECOMP sentence allows analysis of pooled time series and cross section data. The general form of the command is: B34SEXEC ECOMP options parameters $ MODEL Y = X1 X2 X3 $ TITLE=('Test of revised model') $ B34SEEND$ The MODEL sentence is required. The parameters NREG and NPER must be supplied. The default option OLSP provides output for the OLS model, and output using the transformed data. If the independent variable has no variance for any period subset, the OLSP option must be used since the least squares dummy variables model cannot be calculated. For further detail see: - "The Estimation of Dynamic Economic Relations from a Time Series of Cross Sections: A Programing Modification," N. Henry, J, McDonald, and H. H. Stokes in Annals of Economic and Social Measurement, Vol 5, No. 1, 1976, pp 153-155. - "A Program for the Estimation of Dynamic Economic Relations From a Time Series of Cross Sections," A. Freiden, in Annals of Economic and Social Measurement, Vol 2, No. 1, 1973, pp. 89 - 91. Since Error Components Models can be estimated a =number of ways, useful references are: References useful using TSCSREG especially: Baltagi, B. H. and Chang, Y. (1994), "Incomplete Panels: A Comparative Study of Alternative Estimators for the Unbalanced One-way Error Component Regression Model," Journal of Econometrics, 62(2), 67-89. Da Silva, J.G.C. (1975), "The Analysis of Cross-Sectional Time Series Data," Ph.D. dissertation, Department of Statistics, North Carolina State University. SAS Institute Inc. (1979), SAS Technical Report S-106, TSCSREG: A SAS Procedure for the Analysis of Time-Series Cross-Section Data, Cary, NC: SAS Institute Inc. Fuller, W.A. and Battese, G.E. (1974), "Estimation of Linear Models with Crossed-Error Structure," Journal of Econometrics, 2, 67-78. Hausman, J.A. (1978), "Specification Tests in Econometrics," Econometrica, 46, 1251-1271. Hausman, J.A. and Taylor, W.E. (1982), "A Generalized Specification Test," Economics Letters, 8, 239-245. Hsiao, C. (1986), Analysis of Panel Data, Cambridge: Cambridge University Press. Parks, R.W. (1967), "Efficient Estimation of a System of Regression Equations when Disturbances Are Both Serially and Contemporaneously Correlated," Journal of the American Statistical Association, 62, 500-509. Baltagi, Badi. (2005) "Econometric Analysis of Panel Data." Third Edition, John Wiley and Son: Hoboken, NJ. ECOMP options: PRINT - Print first 100 observations. PRINTALL - Print all observations inputted. REGFIRST - Data stored Period 1 Region 1 Period 2 Region 1 This is the default. PERFIRST - Data stored Period 1 Region 1 Period 1 Region 2 OLSP - Calculate p from OLS stage. This is the default. STAGE2P - Calculate p form second stage. BOTHP - Calculate p from OLS stage and second stage use p from second stage. ISWITH - If specified, NREG becomes NPER, NPER becomes NREG, and PERFIRST and REGFIRST interchange. The purpose of this switch is to test the error component in the other direction easily. ISTORE - If PERFIRST was specified, ISTORE will save the data on unit 14 for later use. IRECALL - Will recall data from a previous ISTORE command. If IRECALL is set, REGFIRST must be specified. For multiple ECOMP runs, ISTORE and IRECALL can save substantial computer time for large datasets. It is important that they be used correctly. Casual users should not use these advanced features. ECOMP parameters: NREG = n1 - Specify the number of regions. NPER = n2 - Specify the number of periods. MODEL sentence. MODEL Y = X1 X2 X3 X4 $ The MODEL sentence specifies the model to be estimated. It is a required sentence. TITLE sentence. TITLE=(' up to 80 characters here ') $ The TITLE sentence provides a means to optionally annotate the output. Sample ECOMP setup: B34SEXEC ECOMP NREG=20 NPER=100 PERFIRST$ MODEL Y = X1 X2 X3 $ TITLE=('This is a test of the newer model') $ B34SEEND$ Examples of ECOMP and REG to study Panel Data 2. User wants to run regression subsamples that are marked by the variable FN. Output of the regression is saved in DMF file myruns.dmf with name of runone. A formated dmf file is being used and any data in the file is erased prior to the run. The saved betas are reread into b34s and the results are sorted and listed. Residuals are also saved. b34sexec options ginclude('panel_data.mac') member(grunfeld); b34srun; b34sexec options open('myruns.dmf') unit(60) disp=unknown$ b34seend$ b34sexec options clean(60)$ b34seend$ b34sexec options open('myres.fsv') unit(44) disp=unknown$ b34seend$ b34sexec options clean(44)$ b34seend$ /; simple case shows list /; b34sexec reg panel subkey=fn print; model invest = f c; b34srun; b34sexec reg panel subkey=fn dmfunit=60 dmfmember=runone fdmf fsavunit=44 fsavname=rone savecoef saveres$ model invest = f c; b34srun; /; browse dmf; b34sexec dmf; browse listnames; b34srun; b34sexec data filef=fdmf dmfmember=runone unit(60)$ input ident beta0001 beta0002 tstat001 tstat002 rsq epe dw n$ b34seend$ b34sexec sort$ by beta0001$ b34seend$ b34sexec list $ b34seend$ b34sexec matrix; call loaddata; call graph(beta0001 :heading 'Plot of f coef'); call graph(beta0002 :heading 'Plot of c coef'); call graph(tstat001, tstat002 :nolabel :heading 'Plot of t stats inside the panels'); b34srun; Error Component Example using a range of software. %b34slet runb34s1=1; %b34slet runb34s2=1; %b34slet runrats =1; %b34slet runsas =1; b34sexec options ginclude('panel_data.mac') member(grunfeld); b34srun; /$ Shows ECOMP and REG %b34sif(&runb34s1.ne.0)%then; b34sexec reg $ model invest = f c$ b34srun; b34sexec ecomp regfirst bothp nreg=10 nper=20$ model invest = f c$ b34srun$ b34sexec ecomp regfirst bothp iswith nreg=10 nper=20$ model invest = f c$ b34srun$ %b34sendif; /; /; Matrix Command Options /; %b34sif(&runb34s2.ne.0)%then; b34sexec matrix; call loaddata; call load(panel_lib :staging); call olsq(invest f c :print :savex); /; /; hold data /; call echooff; %xx=%x; %yy=%y; /; call names; itest1=1; itest2=1; itest3=1; if(itest1.eq.1)then; call print(' ':); call print('+++++++++++++++++++++++++++++++++++++++++++++++':); call print(' ':); call panel2fe(%yy,%xx,10,20,%ynew,%xnew,2); call print('Two Way Fixed Effects Estimator panel2fe=2':); call deletecol(%xnew,nocols(%xnew)); call olsq(%ynew %xnew :print :noint); endif; if(itest2.eq.1)then; call print(' ':); call print('+++++++++++++++++++++++++++++++++++++++++++++++':); call print(' ':); call print('Data sorted Before Time fixed effect':); call panel_t( %yy,%xx,10,20,%ynew1,%xnew1); call panel2fe(%ynew1,%xnew1,20,10,%ynew,%xnew,0); call print('Fixed Effects Estimator time correction panel2fe=0':); call deletecol(%xnew,nocols(%xnew)); call olsq(%ynew %xnew :print :noint); call print(' ':); call print('+++++++++++++++++++++++++++++++++++++++++++++++':); call print(' ':); call print('Data not sorted Time Fixed Effect. panel_t not used':); call panel2fe(%yy,%xx,10,20,%ynew,%xnew,1); call print('Fixed Effects Estimator time correction panel2fe=1':); call deletecol(%xnew,nocols(%xnew)); call olsq(%ynew %xnew :print :noint); endif; if(itest3.eq.1)then; call print(' ':); call print('+++++++++++++++++++++++++++++++++++++++++++++++':); call print(' ':); call print('Using panel2fe code':); call panel2fe(%yy,%xx,10,20,%ynew,%xnew,0); call print('Fixed Effects Estimator individual lsvd':); call deletecol(%xnew,nocols(%xnew)); call olsq(%ynew %xnew :print :noint); call print(' ':); call print('+++++++++++++++++++++++++++++++++++++++++++++++':); call print(' ':); call print('Using panel_fe code':); call panel_fe(%yy,%xx,10,20,%ynew,%xnew); call print('Fixed Effects Estimator individual lsvd':); call deletecol(%xnew,nocols(%xnew)); call olsq(%ynew %xnew :print :noint); endif; b34srun; %b34sendif; %b34sif(&runrats.ne.0)%then; b34sexec options open('rats.dat') unit(28) disp=unknown$ b34srun$ b34sexec options open('rats.in') unit(29) disp=unknown$ b34srun$ b34sexec options clean(28)$ b34srun$ b34sexec options clean(29)$ b34srun$ b34sexec pgmcall$ rats passasts pcomments('* ', '* Data passed from B34S system to RATS', '* ', "display @1 %dateandtime() @33 ' Rats Version ' %ratsversion()" '* ') $ PGMCARDS$ * cal(panel=20) 1935 1 1 * print linreg invest / resids # constant f c pstats(tests,effect=indiv) resids pstats(tests,effect=time ) resids pstats(spread) resids pregress(method=fixed,effects=both) invest # f c pregress(method=fixed,effects=individual) invest # f c pregress(method=fixed,effects=time) invest # f c pregress(method=fixed,effects=both) invest # constant f c pregress(method=random,effects=individual) invest # constant f c pregress(method=random,effects=time) invest # constant f c pregress(method=fd,effects=individual) invest # constant f c pregress(method=fd,effects=time) invest # constant f c * pregress(method=sur) invest * # constant f c b34sreturn$ b34srun $ b34sexec options close(28)$ b34srun$ b34sexec options close(29)$ b34srun$ b34sexec options /$ dodos(' rats386 rats.in rats.out ') dodos('start /w /r rats32s rats.in /run') dounix('rats rats.in rats.out')$ B34SRUN$ b34sexec options npageout WRITEOUT('Output from RATS',' ',' ') COPYFOUT('rats.out') dodos('ERASE rats.in','ERASE rats.out','ERASE rats.dat') dounix('rm rats.in','rm rats.out','rm rats.dat') $ B34SRUN$ %b34sendif; %b34sif(&runsas.ne.0)%then; b34sexec options open('testsas.sas') unit(29) disp=unknown$ b34srun$ b34sexec options clean(29) $ b34seend$ b34sexec pgmcall idata=29 icntrl=29$ sas $ * sas commands next ; pgmcards$ proc reg; model invest= f c; run; proc tscsreg; id fn yr; model invest = f c /fixone ; model invest = f c /fixtwo ; model invest = f c /ranone ; model invest = f c /rantwo ; model invest = f c /fuller ; model invest = f c /parks ; model invest = f c /dasilva; model invest = f c /dasilva m=1; model invest = f c /dasilva m=2; run; b34sreturn$ b34srun $ b34sexec options close(29)$ b34srun$ /$ the next card has to be modified to point to sas location /$ be sure and wait until sas gets done before letting b34s resume /$ *************************************************************** b34sexec options dodos('start /w /r sas testsas' ) dounix('sas testsas' ) $ b34srun$ b34sexec options npageout noheader writeout(' ','output from sas',' ',' ') writelog(' ','output from sas',' ',' ') copyfout('testsas.lst') copyflog('testsas.log') dodos('erase testsas.sas','erase testsas.lst','erase testsas.log') dounix('rm testsas.sas','rm testsas.lst','rm testsas.log') $ b34srun$ b34sexec options header$ b34srun$ %b34sendif;