options double crt nwidth=17,signif=9; name grbpre 'Grunfeld data - Breusch-Pagan (1980) tests for Random Effects'; ? Static Panel Model, balanced (stacked) data: ? Follows: ? Baltagi, Badi, "Econometric Analysis of Panel Data", New York: Wiley, 2001 ? by Clint Cummins 5/2002 const n,10 t,20 ystart,1935; ? We do not use FREQ PANEL here, because later in the run, ? we sort by year instead of by firm, to get the means by ? year for the 2-way random effects. ?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 ? read(file='grunfeld.dat') firm year i f k; olsq i c f k; set ssro = @ssr; u = @res; freq(panel,n=n,t=t,id=firm,time=year,start=ystart) a; panel(noreg,silent) u c; ? to compute mean of U by firm, for AA mat sumu = @mean*T; mat AA = 1 - (sumu'sumu)/ssro; ? now compute mean of U by year, for BB sort year u; freq(panel,n=t,t=n) ; panel(noreg,silent) u c; mat sumu = @mean*N; print @mean sumu; mat BB = 1 - (sumu'sumu)/ssro; ? Benchmark - Table 4.1 of Baltagi (2001), p.64 ? ? Baltagi(2001) TSP 4.5 ? LM1 798.162 798.161548369 ? LM2 6.454 6.453881581 ? LM 804.615 804.615429950 ? HO1 28.252 28.251753014 ? ? Notes: ? 1. TSP reproduces Baltagi's results to all reported digits. title 'Breusch-Pagan(1980) test for individual random effects'; set LM1 = NT*AA**2/[2*(T-1)]; cdf(chisq,df=1) LM1 %LM1; print LM1 %LM1; title 'Breusch-Pagan(1980) test for time random effects'; set LM2 = NT*BB**2/[2*(N-1)]; cdf(chisq,df=1) LM2 %LM2; print LM2 %LM2; title 'Breusch-Pagan(1980) test for joint indiv. and time random effects'; set LM = LM1 + LM2; cdf(chisq,df=2) LM %LM; print LM %LM; title 'one-sided test for individual random effects'; set HO1 = sqrt(LM1); cdf(normal,uptail) HO1 %HO1; print HO1 %HO1;