Part 5: Random Effects [ 1/54] Econometric Analysis of Panel Data William Greene Department of Economics Stern School of Business Part 5: Random Effects [ 2/54] The Random Effects Model The random effects model y it = x it β + c i + ε it , o bse rva tio n fo r pe rso n i a t tim e t y i = X iβ + c ii+ ε i , T i o bse rva tio n s in gro u p i = X iβ + c i + ε i , n o te c i (c i , c i ,...,c i ) N y = X β + c + ε , i= 1 T i o bse rva tio n s in th e sa m ple N c= ( c 1 , c 2 , ...c N ) , i= 1 Ti by 1 ve cto r ci is uncorrelated with xit for all t; E[ci |Xi] = 0 E[εit|Xi,ci]=0 Part 5: Random Effects [ 3/54] Random vs. Fixed Effects Random Effects Fixed Effects Small number of parameters Efficient estimation Objectionable orthogonality assumption (ci Xi) Robust – generally consistent Large number of parameters More reasonable assumption Precludes time invariant regressors Which is the more reasonable model? Part 5: Random Effects [ 4/54] Error Components Model Generalized Regression Model y it x it b + ε it + u i E[ε it | X i ] 0 2 2 E[ε it | X i ] σ E[u i | X i ] 0 2 2 E[u i | X i ] σ u 2 u2 2 u V ar[ ε i + u ii ] 2 u y i = X iβ + ε i + u ii fo r T i o b se rv a tio n s 2 2 u 2 2 u 2 u 2 u 2 2 u u Part 5: Random Effects [ 5/54] Notation y1 X1 ε 1 u 1 i1 y2 X2 ε2 u 2 i2 β y X ε u i N N N N N = X β+ ε+ u T1 o b se rv a tio n s T 2 o b se rv a tio n s TN o b se rv a tio n s N i=1 T i o b se rv a tio n s = X β+ w In a ll th a t fo llo w s , e x c e p t w h e re e x p lic itly n o te d , X , X i a n d x it c o n ta in a c o n s ta n t te rm a s th e fir s t e le m e n t. T o a v o id n o ta tio n a l c lu tte r, in th o s e c a s e s , x it e tc . w ill s im p ly d e n o te th e c o u n te rp a rt w ith o u t th e c o n s ta n t te rm . U s e o f th e s y m b o l K fo r th e n u m b e r o f v a ria b le s w ill th u s b e c o n te x t s p e c ific b u t w ill u s u a lly in c lu d e th e c o n s ta n t te rm . Part 5: Random Effects [ 6/54] Notation 2 u2 2 u V a r[ ε i + u ii ] 2 u 2 2 2 u 2 2 u 2 2 u u 2 u 2 u 2 = I T u ii T i T i i 2 2 = I T u ii i = Ωi Ω1 0 V a r[ w | X ] 0 0 Ω2 0 0 0 (N o te th e se d iffe r o n ly in th e d im e n sio n T i ) ΩN 2 2 I T u ii I N Part 5: Random Effects [ 7/54] Regression Model-Orthogonality p lim p lim 1 # o b se rv a tio n s 1 N i 1 Ti X 'w 0 1 N i=1 X i w i p lim N X i ε i p lim N i=1 T i i 1 Ti Ti 1 N i 1 Ti N i=1 X i ( ε i + u ii) 0 X ii i + i=1 T iu i Ti N N X i ε i p lim i=1 fi Ti + i=1 f i N X i ε i p li m i=1 fi Ti + i=1 fi x iu i 0 N N Ti u i , 0 < fi N < 1 Ti i 1 Ti X ii i = 1 N if T i T i Part 5: Random Effects [ 8/54] Convergence of Moments X X N i 1 T X Ω X N i 1 T N i 1 fi N i 1 fi 2 X i X i Ti a w e ig h te d su m o f in d iv id u a l m o m e n t m a t rice s X i Ω i X i Ti N = i 1 fi X i X i Ti a w e ig h te d su m o f in d iv id u a l m o m e n t m a t rice s u i 1 f i x i x i 2 N N o te a sy m p to ti cs a re w ith re sp e ct to N . E a ch m a trix X i X i Ti is th e m o m e n ts fo r th e T i o b se rv a tio n s. S h o u ld b e 'w e ll b e h a v e d ' in m icro le v e l d a ta . T h e a v e ra g e o f N su ch m a tric e s sh o u ld b e lik e w ise . T o r T i is a ssu m e d to b e fix e d (a n d sm a ll). Part 5: Random Effects [ 9/54] Ordinary Least Squares Standard results for OLS in a GR model Consistent Unbiased Inefficient True Variance V a r[b | X ] X X N N i1 Ti i1 Ti 1 0 Q 1 -1 X Ω X X X N N i1 Ti i1 Ti Q * Q 1 -1 0 a s N w ith o u r co n ve rg e n ce a ssu m p tion s Part 5: Random Effects [ 10/54] Estimating the Variance for OLS X X V a r[ b | X ] N N i 1 Ti i 1 Ti 1 X Ω X N i 1 T N i 1 fi X i Ω i X i Ti 1 X Ω X X X N N T T i 1 i i 1 i 1 , w h e re = Ω i = E [ w i w i | X i ] In th e sp irit o f th e W h ite e stim a to r, u s e X Ω X N i 1 T N i 1 fi ˆ iw ˆ i X i X i w Ti ˆ i = y i - X ib , w H y p o th e sis te sts a re th e n b a se d o n W a ld sta tistics. T H IS IS T H E 'C L U S T E R ' E S T IM A T O R Part 5: Random Effects [ 11/54] Mechanics 1 E st.V a r[ b | X ] X X N i 1 ˆ iw ˆ i X i X X X i w 1 ˆ i = se t o f T i O LS re sidu a ls fo r in dividu a l i. w X i = T i xK da ta o n e xo ge n o u s va ria ble fo r in dividu a l i. ˆ i = K x 1 ve cto r o f pro du cts X i w ˆ i )( w ˆ i X i ) K xK m a trix (ra n k 1 , o u te r pro du ct) ( X i w X wˆ wˆ X N i 1 i i i i = su m o f N ra n k 1 m a trice s. R a n k K . Part 5: Random Effects [ 12/54] Cornwell and Rupert Data Cornwell and Rupert Returns to Schooling Data, 595 Individuals, 7 Years Variables in the file are EXP WKS OCC IND SOUTH SMSA MS FEM UNION ED LWAGE = = = = = = = = = = = work experience, EXPSQ = EXP2 weeks worked occupation, 1 if blue collar, 1 if manufacturing industry 1 if resides in south 1 if resides in a city (SMSA) 1 if married 1 if female 1 if wage set by unioin contract years of education log of wage = dependent variable in regressions These data were analyzed in Cornwell, C. and Rupert, P., "Efficient Estimation with Panel Data: An Empirical Comparison of Instrumental Variable Estimators," Journal of Applied Econometrics, 3, 1988, pp. 149-155. See Baltagi, page 122 for further analysis. The data were downloaded from the website for Baltagi's text. Part 5: Random Effects [ 13/54] Alternative OLS Variance Estimators +---------+--------------+----------------+--------+---------+ |Variable | Coefficient | Standard Error |b/St.Er.|P[|Z|>z] | +---------+--------------+----------------+--------+---------+ Constant 5.40159723 .04838934 111.628 .0000 EXP .04084968 .00218534 18.693 .0000 EXPSQ -.00068788 .480428D-04 -14.318 .0000 OCC -.13830480 .01480107 -9.344 .0000 SMSA .14856267 .01206772 12.311 .0000 MS .06798358 .02074599 3.277 .0010 FEM -.40020215 .02526118 -15.843 .0000 UNION .09409925 .01253203 7.509 .0000 ED .05812166 .00260039 22.351 .0000 Robust Constant 5.40159723 .10156038 53.186 .0000 EXP .04084968 .00432272 9.450 .0000 EXPSQ -.00068788 .983981D-04 -6.991 .0000 OCC -.13830480 .02772631 -4.988 .0000 SMSA .14856267 .02423668 6.130 .0000 MS .06798358 .04382220 1.551 .1208 FEM -.40020215 .04961926 -8.065 .0000 UNION .09409925 .02422669 3.884 .0001 ED .05812166 .00555697 10.459 .0000 Part 5: Random Effects [ 14/54] Generalized Least Squares ˆ = [ X Ω -1 X ] 1 [ X Ω -1 y ] β N -1 1 N -1 = [ i 1 X i Ω i X i ] [ i 1 X i Ω i y i ] -1 Ωi 2 1 u 2 I T 2 ii 2 i Ti u (n o te , d e p e n d s o n i o n ly th ro u g h T i ) Part 5: Random Effects [ 15/54] Panel Data Algebra (1) 2 2 Ω i = σ ε I + σ u ii , d e p e n d s o n 'i' b e ca u se it is T i T i 2 2 2 2 Ω i = σ ε [ I + ii], 2 2 2 = σu / σε 2 Ω i = σ ε [ I + ii] = σ ε [ A b b ], A = I , b = i. U sin g (A -6 6 ) in G re e n e (p . 9 6 4 ) -1 Ωi 1 -1 1 -1 -1 A A b b A 2 -1 σ ε 1 + b A b 2 σ 1 1 1 2 u = I ii = I- 2 ii 2 2 2 2 σε 1 + Ti σε σ ε + Tiσ u Part 5: Random Effects [ 16/54] Panel Data Algebra (2) (B a se d o n W o o ldridge p. 2 8 6 ) 2 2 2 2 -1 2 2 i Ω i σ ε I + σ u ii σ ε I + T i σ u i(i i) i σ ε I + T i σ u PD 2 2 i σ ε I + Ti σ u ( I M D ) 2 2 i 2 2 i 2 2 i 2 2 2 (σ ε + T i σ u )[ PD ( I PD )], i = σ ε /(σ ε + T i σ u ) i (σ ε + T i σ u )[ PD M D ] (σ ε + Ti σ u ) S i 1 Si 1 / 2 Si i i i i PD (1 / i )M D (Pro ve by m u ltiplyin g. PD M D 0 .) i PD (1 / a (N o te S i i i i )M D a i PD i M D ) 1 I iPDi , i = 1 - i 1 i Part 5: Random Effects [ 17/54] Panel Data Algebra (3) 1 / 2 1 Ωi i 2 i (PD (1 / 2 Ti u 1 i )M D ) 1 I iPDi , 2 2 Ti u 1 i 2 i = 1- 1 / 2 Ωi 1 / 2 V a r[ Ω i 1 / 2 Ωi 2 2 Ti u 1 1 2 2 Ti u i [ I iPD ] 2 ( ε i u ii)] I y i (1 / )( y i i y i .i) fo r th e G LS tra n sf o rm a tio n . Part 5: Random Effects [ 18/54] GLS (cont.) G LS is e qu iva le n t to O LS re gre ssio n o f y it * y it i y i . o n x it * x it i x i ., w h e re i 1 2 2 Ti u ˆ ] [ X Ω -1 X ] -1 2 [ X * X * ] -1 A sy.V a r[β Part 5: Random Effects [ 19/54] Estimators for the Variances y it x it β it u i U sin g th e O L S e stim a to r o f β , b O LS , N T i 1 t i 1 ( y it - a - x it b ) N i 1 2 2 2 e stim a te s U Ti -1 -K W ith th e L S D V e stim a te s, a i a n d b LS D V , N T i 1 t i 1 ( y it - a i - x it b ) N i 1 Ti -N -K 2 2 e stim a te s U sin g th e d iffe re n ce o f th e tw o , N Ti ( y - a - x b ) 2 it i 1 t 1 it N i 1 T i -1 -K N Ti ( y - a - x b ) 2 i it i 1 t 1 it N i 1 T i -N -K e stim a te s U2 Part 5: Random Effects [ 20/54] Feasible GLS 2 2 Fe a sible G LS re qu ire s (o n ly) co n siste n t e stim a to rs o f a n d u . C a n dida te s: T N i 1 t i 1 ( y it a i x it b LS D V ) 2 Fro m th e ro bu st LS D V e stim a to r: ˆ 2 N i 1 Ti K N T N 2 2 Fro m th e po o le d O LS e stim a to r: E st( u ) i 1 t i 1 ( y it a O LS x it b O LS ) N i 1 Ti K 1 N 2 2 u Fro m th e gro u p m e a n s re gre ssio n : E st( / T ) i 1 ( y it a x ib M E A N S ) N K 1 N ( W o o ldridge ) B a se d o n E [w it w is | X i ] 2 u 2 2 u if t s, ˆ T h e re a re m a n y o th e rs. x´ does not contain a constant term in the preceding. T 1 T ˆ it w ˆ is i 1 t i 1 s i t 1 w N i 1 Ti K N 2 Part 5: Random Effects [ 21/54] Practical Problems with FGLS 2 T h e p re c e d in g re g u la rly p ro d u c e n e g a tiv e e stim a te s o f u . E stim a tio n is m a d e v e ry c o m p lic a te d in u n b a la n c e d p a n e ls. A b u lle tp ro o f so lu tio n (o rig in a lly u se d in T S P , n o w N L O G IT a n d o th e rs). T N i 1 t i 1 ( y it a i x it b L S D V ) 2 Fro m th e r o b u st L S D V e stim a to r: ˆ N i1 Ti N 2 2 Fro m th e p o o le d O L S e stim a to r: E st( u ) N 2 ˆu T 2 N T T i 1 t i 1 ( y it a O L S x it b O L S ) N i1 Ti i 1 t i 1 ( y it a O L S x it b O L S ) i 1 t i 1 ( y it a i x it b L S D V ) N 2 i1 Ti 2 0 2 2 ˆ Part 5: Random Effects [ 22/54] Stata Variance Estimators N 2 ˆ T i 1 t i 1 ( y it a i x it b LS D V ) N i 1 Ti K N 2 > 0 ba se d o n FE e stim a te s 2 (N K ) S S E (gro u p m e a n s) ˆ 2 ˆ u M ax 0 , N A (N A ) T 0 2 w h e re A = K o r if ˆ u is n e ga tive , A = tra ce o f a m a trix th a t so m e w h a t re se m ble s I K . M a n y o th e r a dju stm e n ts e x ist. N o n e gu a ra n te e d to be po sitive . N o o ptim a lity pro pe rtie s o r e v e n gu a ra n te e d co n siste n cy. Part 5: Random Effects [ 23/54] Computing Variance Estimators U sin g fu ll list o f va ria b le s (FE M a n d E D a re tim e in va ria n t) O LS su m o f sq u a re s = 5 2 2 .2 0 0 8 . 2 2 E st( + u ) = 5 2 2 .2 0 0 8 / (4 1 6 5 - 9 ) = 0 .1 2 5 6 5 . U sin g fu ll list o f va ria b le s a n d a g e n e r a lize d in ve rse (sa m e a s d ro p p in g FE M a n d E D ), LS D V su m o f sq u a re s = 8 2 .3 4 9 1 2 . 2 ˆ = 8 2 .3 4 9 1 2 / (4 1 6 5 - 8 -5 9 5 ) = 0 .0 2 3 1 1 9 . 2 ˆ u 0 .1 2 5 6 5 - 0 .0 2 3 1 1 9 = 0 .1 0 2 5 3 2 B o th e stim a to rs a re p o sitive . W e ca n sto p h e re . If ˆ u w e re n e g a tive , w e w o u ld u se e stim a to rs w ith o u t D F co r re ctio n s. Part 5: Random Effects [ 24/54] Application +--------------------------------------------------+ | Random Effects Model: v(i,t) = e(i,t) + u(i) | | Estimates: Var[e] = .231188D-01 | | Var[u] = .102531D+00 | | Corr[v(i,t),v(i,s)] = .816006 | | (High (low) values of H favor FEM (REM).) | | Sum of Squares .141124D+04 | | R-squared -.591198D+00 | +--------------------------------------------------+ +---------+--------------+----------------+--------+---------+----------+ |Variable | Coefficient | Standard Error |b/St.Er.|P[|Z|>z] | Mean of X| +---------+--------------+----------------+--------+---------+----------+ EXP .08819204 .00224823 39.227 .0000 19.8537815 EXPSQ -.00076604 .496074D-04 -15.442 .0000 514.405042 OCC -.04243576 .01298466 -3.268 .0011 .51116447 SMSA -.03404260 .01620508 -2.101 .0357 .65378151 MS -.06708159 .01794516 -3.738 .0002 .81440576 FEM -.34346104 .04536453 -7.571 .0000 .11260504 UNION .05752770 .01350031 4.261 .0000 .36398559 ED .11028379 .00510008 21.624 .0000 12.8453782 Constant 4.01913257 .07724830 52.029 .0000 Part 5: Random Effects [ 25/54] Testing for Effects: An LM Test B reu sch a n d P a g a n La g ra n g e M u ltip lier st a tistic y it x it u i it , u i a n d it 0 u2 ~ N orm a l , 0 0 2 H0 : u 0 N 2 N 2 2 i 1 ( Ti e i ) 2 LM = 1 [1] N T 2 N 2 i 1 T ( T i 1) i 1 t 1 e it i ( i 1 Ti ) = 2 N 2 T i1 ei 1 N T 2 2( T 1) i 1 t 1 e it NT 2 if T is con sta n t 0 2 Part 5: Random Effects [ 26/54] LM Tests +--------------------------------------------------+ | Random Effects Model: v(i,t) = e(i,t) + u(i) | | Estimates: Var[e] = .216794D+02 | | Var[u] = .958560D+01 | | Corr[v(i,t),v(i,s)] = .306592 | | Lagrange Multiplier Test vs. Model (3) = 4419.33 | | ( 1 df, prob value = .000000) | | (High values of LM favor FEM/REM over CR model.) | | Baltagi-Li form of LM Statistic = 1618.75 | +--------------------------------------------------+ +--------------------------------------------------+ | Random Effects Model: v(i,t) = e(i,t) + u(i) | | Estimates: Var[e] = .210257D+02 | | Var[u] = .860646D+01 | | Corr[v(i,t),v(i,s)] = .290444 | | Lagrange Multiplier Test vs. Model (3) = 1561.57 | | ( 1 df, prob value = .000000) | | (High values of LM favor FEM/REM over CR model.) | | Baltagi-Li form of LM Statistic = 1561.57 | +--------------------------------------------------+ Unbalanced Panel #(T=1) = 1525 #(T=2) = 1079 #(T=3) = 825 #(T=4) = 926 #(T=5) = 1051 #(T=6) = 1200 #(T=7) = 887 Balanced Panel T = 7 REGRESS ; Lhs=docvis ; Rhs=one,hhninc,age,female,educ ; panel $ Part 5: Random Effects [ 27/54] Testing for Effects: Moments W o o ld rid g e (p a g e 2 6 5 ) su g g e sts b a se d o n th e o ff d ia g o n a l e le m e n ts N Z= T -1 T i= 1 t= 1 s= t+ 1 e it e is N T -1 T i= 1 t= 1 s= t+ 1 e it e is d 2 N[0 , 1] w h ich co n v e rg e s to sta n d a rd n o rm a l. ("W e a re n o t a ssu m in g a n y p a rticu la r d istrib u tio n fo r th e it . In ste a d , w e d e riv e a sim ila r te st th a t h a s th e a d v a n ta g e o f b e in g v a lid fo r a n y d istrib u tio n ...") It's co n v e n ie n t to e x a m in e Z 2 w h ich , b y th e S lu tsk y th e o r e m co n v e rg e s (a lso ) to ch i- sq u a re d w ith o n e d e g re e o f fre e d o m . Part 5: Random Effects [ 28/54] Testing (2) T -1 T t= 1 s= t+ 1 e it e is = 1 /2 o f th e su m o f a ll o ff d ia g o n a l e le m e n ts o f o f e i e i o r 1 /2 th e su m o f a ll th e e le m e n ts m in u s th e d ia g o n a l e le m e n ts. T -1 T T -1 T 2 t= 1 s= t+ 1 e it e is = 1 /2 [ i ( e i e i ) i e ie i ]. B u t, i e i = T e i . S o , 2 t= 1 s= t+ 1 e it e is = (1 /2 )[(T e i ) e ie i ] Z N 2 N 2 2 i 1 [(T e i ) e ie i ] i 1 [(T e i ) e ie i ] 2 LM N [ i 1 e ie i ] NT i 1 [(T e i ) e ie i ] N N o te , a lso N Z= i 1 ri N i 1 ri 2 N r sr 2 2( T 1) 2 , w h e re ri (T e i ) e ie i . 2 2 Part 5: Random Effects [ 29/54] Testing for Effects ? Obtain OLS residuals Regress; lhs=lwage;rhs=fixedx,varyingx;res=e$ ? Vector of group sums of residuals Calc ; T = 7 ; Groups = 595 Matrix ; tebar=T*gxbr(e,person)$ ? Direct computation of LM statistic Calc ; list;lm=Groups*T/(2*(T-1))* (tebar'tebar/sumsqdev - 1)^2$ ? Wooldridge chi squared (N(0,1) squared) Create ; e2=e*e$ Matrix ; e2i=T*gxbr(e2,person)$ Matrix ; ri=dirp(tebar,tebar)-e2i ; sumri=ri'1$ Calc ; list;z2=(sumri)^2/ri'ri$ LM Z2 = .37970675705025540D+04 = .16533465085356830D+03 Part 5: Random Effects [ 30/54] Two Way Random Effects Model y it x it u i v t it H o w to e stim a te th e v a ria n ce co m p o n e n ts? 2 (1 ) T w o w a y F E M re sid u a l v a ria n ce e stim a te s 2 2 2 (2) S im p le O L S re sid u a l v a ria n ce e stim a t e s u v (3) T h e re a re n u m e ro u s w a y s to g e t a th i rd e q u a tio n . E .g ., th e o n e w a y F E M re sid u a l v a ria n ce in e ith e r d im e n sio n 2 2 O n e w a y F E M b a se d o n g ro u p s e stim a t e s ( v ) / (1 1 / T ) E .g ., th e g ro u p m e a n re g re ssio n s in e ith e r d im e n sio n . 2 2 2 B a se d o n g ro u p m e a n s e stim a te s u ( v )/T (P e rio d m e a n s re g re ssio n m a y h a v e a tin y n u m b e r o f o b se rv a tio n s.) (A n d a w h o le lib ra ry o f o th e rs - se e B a lta g i, se c. 3 .3 .) N e g a tiv e e stim a to rs o f c o m m o n v a ria n ce s a re co m m o n . S o lu tio n s a re co m p lica te d . Part 5: Random Effects [ 31/54] One Way REM Part 5: Random Effects [ 32/54] Two Way REM Note sum = .102705 Part 5: Random Effects [ 33/54] Hausman Test for FE vs. RE Estimator FGLS (Random Effects) LSDV (Fixed Effects) Random Effects E[ci|Xi] = 0 Consistent and Efficient Fixed Effects E[ci|Xi] ≠ 0 Inconsistent Consistent Inefficient Consistent Possibly Efficient Part 5: Random Effects [ 34/54] Hausman Test for Effects ˆ -β ˆ B a sis fo r th e te st, β FE RE ˆ -β ˆ ; W = q ˆ = β ˆ [V a r( q ˆ )] -1 q ˆ W a ld C rite rio n : q FE RE A le m m a (H a u sm a n (1 9 7 8 )): U n d e r th e n u ll h y p o th e sis (R E ) d ˆ - β ] n T [β N [ 0 , V R E ] (e fficie n t) RE d ˆ - β ] n T [β N [ 0 , V F E ] (in e fficie n t) FE ˆ - β )-( β ˆ β ). T h e le m m a sta te s th a t in th e ˆ = (β N o te : q FE RE jo in t lim itin g d istrib u tio n o f ˆ - β] and nT [β RE ˆ , th e nT q lim itin g co v a ria n ce , C Q ,R E is 0 . B u t, C Q ,R E = C F E ,R E - V R E . T h e n , V a r[ q ] = V F E + V R E - C F E ,R E - C F E ,R E . U sin g th e le m m a , C F E ,R E = VR E . It fo llo w s th a t V a r[ q ]= V F E - V R E . B a se d o n th e p re ce d in g ˆ -β ˆ ) [E st.V a r( β ˆ ) - E st.V a r( β ˆ )] -1 ( β ˆ -β ˆ ) H = (β FE RE FE RE FE RE β does not contain the constant term in the preceding. Part 5: Random Effects [ 35/54] Computing the Hausman Statistic N 1 2 ˆ E st.V a r[ β F E ] ii X i ˆ i 1 X i I T i N ˆ i 2 ˆ E st.V a r[ β R E ] ii X i ˆ i 1 X i I T i 1 -1 2 , 0 ˆ i = Ti ˆu 2 2 ˆ Ti ˆu 1 2 2 ˆ ] E st.V a r[ β ˆ ] A s lo n g a s ˆ and ˆ u a re c o n siste n t, a s N , E st.V a r[ β FE RE w ill b e n o n n e g a tiv e d e fin ite . In a fin ite sa m p le , to e n su re th is, b o th m u st 2 b e c o m p u te d u sin g th e sa m e e stim a te o f ˆ . T h e o n e b a se d o n L S D V w ill g e n e ra lly b e th e b e tte r c h o ic e . ˆ ] if th e re a re tim e N o te th a t c o lu m n s o f ze ro s w ill a p p e a r in E st.V a r[ β FE in v a ria n t v a ria b le s in X . β does not contain the constant term in the preceding. Part 5: Random Effects [ 36/54] Part 5: Random Effects [ 37/54] Part 5: Random Effects [ 38/54] Hausman Test? What went wrong? The matrix is not positive definite. It has a negative characteristic root. The matrix is indefinite. (Software such as Stata and NLOGIT find this problem and refuse to proceed.) Properly, the statistic cannot be computed. The naïve calculation came out positive by the luck of the draw. Part 5: Random Effects [ 39/54] A Variable Addition Test Asymptotically equivalent to Hausman Also equivalent to Mundlak formulation In the random effects model, using FGLS Only applies to time varying variables Add expanded group means to the regression (i.e., observation i,t gets same group means for all t. Use standard F or Wald test to test for coefficients on means equal to 0. Large F or chi-squared weighs against random effects specification. Part 5: Random Effects [ 40/54] Variable Addition A Fixed E ffects M odel y it i x it it LS D V estim ator - D eviations from group m eans: T o estim ate , regress (y it y i ) on ( x it x i ) A lgebraic equivalent: O LS regress y it on ( x it , x i ) M undlak interpretation: i x i u i M odel becom es y it x i u i x it it = x i x it it u i a random effects m odel w ith the group m eans. E stim ate by FG LS . Part 5: Random Effects [ 41/54] Application: Wu Test NAMELIST create ; create ; create ; create ; create ; create ; create ; create ; create ; namelist ; XV = exp,expsq,wks,occ,ind,south,smsa,ms,union,ed,fem$ expb=groupmean(exp,pds=7)$ expsqb=groupmean(expsq,pds=7)$ wksb=groupmean(wks,pds=7)$ occb=groupmean(occ,pds=7)$ indb=groupmean(ind,pds=7)$ southb=groupmean(south,pds=7)$ smsab=groupmean(smsa,pds=7)$ unionb=groupmean(union,pds=7)$ msb = groupmean(ms,pds=7) $ ; xmeans = expb,expsqb,wksb,occb,indb,southb,smsab,msb, unionb $ REGRESS ; Lhs = lwage ; Rhs = xmeans,Xv,one ; panel ; random $ MATRIX ; bmean = b(1:9) ; vmean = varb(1:9,1:9) $ MATRIX ; List ; Wu = bmean'<vmean>bmean $ Part 5: Random Effects [ 42/54] Means Added Part 5: Random Effects [ 43/54] Wu (Variable Addition) Test Part 5: Random Effects [ 44/54] Basing Wu Test on a Robust VC ? Robust Covariance matrix for REM Namelist ; XWU = wks,occ,ind,south,smsa,union,exp,expsq,ed,blk,fem, wksb,occb,indb,southb,smsab,unionb,expb,expsqb,one $ Create ; ewu = lwage - xwu'b $ Matrix ; Robustvc = <Xwu'Xwu>*Gmmw(xwu,ewu,_stratum)*<XwU'xWU> ; Stat(b,RobustVc,Xwu) $ Matrix ; Means = b(12:19);Vmeans=RobustVC(12:19,12:19) ; List ; RobustW=Means'<Vmeans>Means $ Part 5: Random Effects [ 45/54] Robust Standard Errors Part 5: Random Effects [ 46/54] Fixed vs. Random Effects ˆ β M odel N ˆ i,M o d e l i 1 X i I ii X i Ti -1 N ˆ i,M o d e l ii y i i 1 X i I Ti ˆ M o d e l 1 fo r fix e d e ffe cts. 2 ˆ i,M o d e l Ti ˆu 2 ˆ Ti ˆ 2 u fo r ra n d o m e ffe cts. A s T i , ˆ i,R E 1, ra n d o m e ffe cts b e co m e s fix e d e ffe cts 2 As ˆ u 0 , ˆ i,R E 0 , ra n d o m e ffe cts b e co m e s O LS (o f c o u rse ) 2 As ˆ u , ˆ i,R E 1, ra n d o m e ffe cts b e co m e s fix e d e ffe cts 2 2 Fo r th e C & R a p p lica tio n , ˆ u = .1 3 3 1 5 6 , ˆ = .0 2 3 5 2 3 1 , ˆ .9 7 5 3 8 4 . Lo o ks like a fix e d e ffe cts m o d e l. N o te th e H a u sm a n sta tistic a g re e s. β does not contain the constant term in the preceding. Part 5: Random Effects [ 47/54] Another Comparison (Baltagi p. 20) ˆ ˆ ˆ W ( I W ) G LS LS D V ( W ith in ) B etw een Lim itin g an d S p ecial C ases 2 (1 ) If u 0, G LS = O LS (2) A s T , G LS ˆ LS D V ( W ith in ) ˆ ˆ (3 ) A s b etw een variation 0, G LS LS D V ( W ith in ) ˆ ˆ (4 ) A s w ith in variation 0, G LS B etw een Part 5: Random Effects [ 48/54] A Hierarchical Linear Model Interpretation of the FE Model y it x it β c i + ε it , ( x d o e s n o t co n ta in a co n sta n t) 2 E [ε it | X i , c i ] 0 , V a r[ε it | X i , c i ]= c i + z i δ + u i , 2 E [u i| z i ] 0 , V a r[u i| z i ] u y it x it β [ z i δ u i ] ε it Part 5: Random Effects [ 49/54] Hierarchical Linear Model as REM +--------------------------------------------------+ | Random Effects Model: v(i,t) = e(i,t) + u(i) | | Estimates: Var[e] = .235368D-01 | | Var[u] = .110254D+00 | | Corr[v(i,t),v(i,s)] = .824078 | | Sigma(u) = 0.3303 | +--------------------------------------------------+ +--------+--------------+----------------+--------+--------+----------+ |Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X| +--------+--------------+----------------+--------+--------+----------+ OCC | -.03908144 .01298962 -3.009 .0026 .51116447 SMSA | -.03881553 .01645862 -2.358 .0184 .65378151 MS | -.06557030 .01815465 -3.612 .0003 .81440576 EXP | .05737298 .00088467 64.852 .0000 19.8537815 FEM | -.34715010 .04681514 -7.415 .0000 .11260504 ED | .11120152 .00525209 21.173 .0000 12.8453782 Constant| 4.24669585 .07763394 54.702 .0000 Part 5: Random Effects [ 50/54] Evolution: Correlated Random Effects U nknow n param eters y it i x it it , [ 1 , 2 , ..., N , , ] 2 S tandard estim ation based on L S (dum m y v ariables) A m biguous definition of the distribution of y it E ffects m odel, nonorthogonality, heterog eneit y y it i x it it , E[ i | X i ] g ( X i ) 0 C ontrast to random effects E[ i | X i ] S tandard estim ation (still) based on L S (dum m y variables) C orrelated random effects, m ore detailed m odel y it i x it it , P[ i | X i ] g ( X i ) 0 L inear projection? i x i u i C or(u i , x i ) 0 Part 5: Random Effects [ 51/54] Mundlak’s Estimator Mundlak, Y., “On the Pooling of Time Series and Cross Section Data, Econometrica, 46, 1978, pp. 69-85. W rite c i = x i δ u i , E [c i | x i1 , x i1 , ... x iT ] = x i δ i A ssu m e c i c o n ta in s a ll tim e in v a ria n t in fo rm a tio n y i = X iβ + c ii+ ε i , T i o b se rv a tio n s in g ro u p i = X iβ + ix i δ + ε i + u ii L o o k s lik e ra n d o m e ffe c ts. 2 V a r[ ε i + u ii]= Ω i + σ u ii T h is is th e m o d e l w e u se d fo r th e W u te s t. Part 5: Random Effects [ 52/54] Correlated Random Effects M u n d la k c i = x i δ u i , E [c i | x i1 , x i1 , ... x iT ] = x i δ i A ssu m e c i co n ta in s a ll tim e in v a ria n t in fo rm a tio n y i = X iβ + c ii+ ε i , T i o b se rv a tio n s in g ro u p i = X iβ + ix i δ + ε i + u ii C h a m b e rla in / W o o ld ri d g e c i = x i1 δ 1 x i2 δ 2 ... x iT δ T u i y i = X iβ ix i1 δ 1 ix i1 δ 2 ... ix iT δ T i u i + ε i TxK TxK TxK TxK e tc. P ro b le m s: R e q u ire s b a la n ce d p a n e ls M o d e rn p a n e ls h a v e la rg e T ; m o d e ls h a v e la rg e K Part 5: Random Effects [ 53/54] Mundlak’s Approach for an FE Model with Time Invariant Variables y it x it β + z i δ c i + ε it , ( x do e s n o t co n ta in a co n sta n t) 2 E [ε it | X i , c i ] 0 , V a r[ε it | X i , c i ]= c i + x i θ + w i , 2 E [w i| X i , z i ] 0 , V a r[w i| X i , z i ] w y it x it β z i δ x i θ w i ε it ra n do m e ffe cts m o de l in clu din g gro u p m e a n s o f tim e va ryin g va ria ble s. Part 5: Random Effects [ 54/54] Mundlak Form of FE Model +--------+--------------+----------------+--------+--------+----------+ |Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X| +--------+--------------+----------------+--------+--------+----------+ x(i,t)================================================================= OCC | -.02021384 .01375165 -1.470 .1416 .51116447 SMSA | -.04250645 .01951727 -2.178 .0294 .65378151 MS | -.02946444 .01915264 -1.538 .1240 .81440576 EXP | .09665711 .00119262 81.046 .0000 19.8537815 z(i)=================================================================== FEM | -.34322129 .05725632 -5.994 .0000 .11260504 ED | .05099781 .00575551 8.861 .0000 12.8453782 Means of x(i,t) and constant=========================================== Constant| 5.72655261 .10300460 55.595 .0000 OCCB | -.10850252 .03635921 -2.984 .0028 .51116447 SMSAB | .22934020 .03282197 6.987 .0000 .65378151 MSB | .20453332 .05329948 3.837 .0001 .81440576 EXPB | -.08988632 .00165025 -54.468 .0000 19.8537815 Variance Estimates===================================================== Var[e]| .0235632 Var[u]| .0773825