options double crt nwidth=17,signif=9; name grbi 'Grunfeld data - coefficients varying by i'; ? by Clint Cummins 5/2003 const n,10 t,20 ystart,1935; freq(panel,n=n,t=t,id=firm,time=year,start=ystart) a; set nt = n*t; smpl 1,nt; ? Data for all 10 firms, 20 years, in Boot and de Wit, IER (1960); ? downloaded from Springer-Verlag web page: ? http://www.springer.de/economics/samsup/baltagi , 10/99 ? Data also printed in Maddala, Econometrics, 1977, p.214-215. ? ? The firm names (roughly in order by size) are G.M., U.S. Steel, G.E., ? Chrysler, Atlantic Richfield (or Refining), I.B.M., Union Oil, ? Westinghouse, Goodyear, and Diamond Match. This ordering may not ? match the data file used here. ? The years are 1935-1954. ? Variables are: ? INV = gross investment ? F = value of the firm, lagged by one year ? K = value of firm capital stock (plant and equipment), lagged by one year ? read(file='grunfeld.dat') firm year inv f k; ? define lists here to specify model list xid firm; ? id variable (coded 1 to n) set n = 10; list y inv; list xc f k; ? vars with constant coefs list xi c; ? vars whose coefs vary by i title 'Test 1: fixed individual effects'; ? Benchmarks: Baltagi(1995), p.20 ? ? 2. Fixed Individual Effects / Within Firm ? Baltagi TSP ? F .11012 .1101238041 ? (SEdf) (.01186) (.0118566942) ? K .31007 .3100653413 ? (.01735) (.0173545028) ? LogL ? -1070.781026499 ? 2. (SEdf) is the Standard Error, computed with the usual ? degrees of freedom correction for t-statistics in OLS. title 'check against OLS'; dummy firm; ols y xc firm1-firm10; title 'compute with Proc panbi'; Panbi y xc xi xid n; title 'Test 2: F varies by i'; list xc k c; list xi f; title 'OLS benchmark'; dot 1-10; f. = f*firm.; enddot; ols y xc f1-f10; title 'Panbi version'; Panbi y xc xi xid n; title 'Test 3: F and C vary by i'; list xc k; list xi f c; title 'OLS benchmark'; dot 1-10; f. = f*firm.; enddot; ols y xc f1-f10 firm1-firm10; title 'Panbi version'; Panbi y xc xi xid n; Proc Panbi y xc xi xid n; ? Panel regression where some variables have ? coefficients which vary by i. ? The user specifies the following input arguments: ? y = dependent variable ? xc = list of RHS variables with constant coefs ? xi = list of RHS variables with coefs which vary by i ? xid = ID variable, coded 1 to N ? N = scalar variable - number of individuals ? by Clint Cummins 5/03 local tvars i nxi dfr vcov yhat res bi; list(prefix=t) tvars y xc; local tvars; dot tvars; ? create transformed variables . = 0; enddot; regopt(nocalc) het auto; ? turn off diagnostics for faster regr. supres smpl; do i=1,n; select(noprint) xid=i; dot y xc; olsq(silent) . xi; t. = @res; enddot; enddo; select 1; regopt; supres coef; olsq tvars; nosupres coef; ? correct df for SEs length xi nxi; set dfr = (@nob-@ncoef)/(@nob-@ncoef-nxi*n); mat vcov = @vcov*dfr; tstats(names=@rnms) @coef vcov; title 'recover coefs which vary by i'; forcst yhat xc; res = y-yhat; list(prefix=b) bi xi; local bi; dot bi; . = 0; enddot; supres smpl; do i=1,n; select(noprint) xid=i; olsq(silent) res xi; dot(index=kk) xi; b. = @coef(kk); enddot; enddo; select 1; print bi; ? If you need to do computations on bi, do them here. endproc;