Econometric Analysis of Panel Data
William Greene
Department of Economics
Stern School of Business
Econometric Analysis of Panel Data
5. Random Effects Linear Model
The Random Effects Model
The random effects model
y it =x β+c i +εit , observation for person i at time t
it
y i =X iβ+c ii+ε i , Ti observations in group i
=X iβ+c i +ε i , note c i (c i , c i ,...,c i )
y =Xβ+c +ε , N Ti observations in the sample
i=1
2
c=(c1 , c ,...c ), N Ti by 1 vector
N i=1
ci is uncorrelated with xit for all t;
E[ci |Xi] = 0
E[εit|Xi,ci]=0
Error Components Model
Generalized Regression Model
y it x b+εit +ui
it
E[εit | X i ] 0 2 u
2
u2
u
2
u2
2 u
2
u
2
Var[ε i +uii ]
2 2
E[εit | X i ] σ
E[ui | X i ] 0 2
u u u
2 2 2
2
E[ui2 | X i ] σ u
y i =X iβ+ε i +uii for Ti observations
Notation
y1 X1 ε1 u1i1 T1 observations
y X ε u i T observations
2
2
β 2 2 2 2
yN XN εN uNiN TN observations
= Xβ+ε+u N Ti observations
i=1
= Xβ+w
In all that follows, except where explicitly noted, X, X i
and x contain a constant term as the first element.
it
To avoid notational clutter, in those cases, x etc. will
it
simply denote the counterpart without the constant term.
Use of the symbol K for the number of variables will thus
be context specific but will usually include the constant term.
Notation
2 u
2
u2
u
2
u 2 u u
2 2 2
Var[ε i +uii ]
2
u u 2 u
2 2
= 2I Ti u ii Ti Ti
2
= 2I Ti u ii
2
= Ωi
Ω1 0 0
0 Ω2 0 (Note these differ only
Var[w | X ]
in the dimension Ti )
0
0 ΩN
Regression Model-Orthogonality
1
plim X'w 0
# observations
1 1
plim N i=1 X w i plim N N X (ε i +uii) 0
N
i i=1 i
i1 Ti i1 Ti
1 N X ε i N X ii
plim N i=1 Ti i
+ i=1 Tui i
i
i1 Ti Ti Ti
N X ε i N X ii Ti
plim i=1 fi i
+ i=1 fi i
ui , 0 z] | Mean of X|
+---------+--------------+----------------+--------+---------+----------+
Constant 5.40159723 .04838934 111.628 .0000
EXP .04084968 .00218534 18.693 .0000 19.8537815
EXPSQ -.00068788 .480428D-04 -14.318 .0000 514.405042
OCC -.13830480 .01480107 -9.344 .0000 .51116447
SMSA .14856267 .01206772 12.311 .0000 .65378151
MS .06798358 .02074599 3.277 .0010 .81440576
FEM -.40020215 .02526118 -15.843 .0000 .11260504
UNION .09409925 .01253203 7.509 .0000 .36398559
ED .05812166 .00260039 22.351 .0000 12.8453782
Alternative 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
Generalized Least Squares
ˆ
β=[X Ω-1 X ]1 [X Ω-1 y ]
=[N 1 X Ωi-1 X i ]1 [N 1 X Ωi-1 y i ]
i i i i
1 2
-1
Ωi 2 I Ti 2
2
ii
Tiu
(note, depends on i only through Ti )
Panel Data Algebra (1)
Ωi = σ 2I+σ uii, depends on 'i' because it is Ti Ti
ε
2
Ωi = σ 2 [I + 2ii], 2 = σ u / σ 2
ε
2
ε
Ωi = σ 2 [I + 2ii] = σ 2 [A bb], A=I, b=i.
ε ε
Using (A-66) in Greene (p. 964)
1 -1 1
Ωi-1 A - A -1bbA -1
σ2
ε 1+bA -1b
1 1 1 2
σu
= 2 I - 2
ii = 2 I - 2
2
2
ii
σε 1+Ti σ ε σ ε +Tσ u
i
Panel Data Algebra (2)
(Based on Wooldridge p. 286)
Ωi σ 2I+σ uii σ 2I+Tσ ui(ii)-1 i σ 2I+Tσ uPD
ε
2
ε i
2
ε i
2 i
2 i
σ 2I+Tσ u (I MD )
ε i
(σ 2 +Tσ u )[PD (I PD )], i = σ 2 /(σ 2 +Tσ u )
ε i
2 i i
ε ε i
2
2 i i
(σ 2 +Tσ u )[PD MD ]
ε i
2
(σ 2 +Tσ u )S i
ε i
S i1 PD (1 / i )MD (Prove by multiplying. PDMD 0.)
i i i i
1
S i1 / 2 PD (1 / i )MD
i i
I iPD , i=1- i
i
1 i
i i
(Note S ia PD iaMD )
Panel Data Algebra (2, cont.)
1
Ωi1 / 2 i i
(PD (1 / i )MD )
2
2 Tiu
1 1
I iPD ,
i
2 Tiu 1 i
2
2
i =1- 2 2 1
Tiu 2
2 Tiu
1
Ωi1 / 2 i
[I iPD ]
Var[Ωi1 / 2 (ε i uii)] 2I
Ωi1 / 2 y i (1 / )( y i i y i .i) for the GLS transformation.
GLS (cont.)
GLS is equivalent to OLS regression of
y it * y it i y i . on x it * x it i x i .,
where i 1
2
2 Tiu
ˆ
Asy.Var[β] [X Ω-1 X ]-1 2 [X * X*]-1
Estimators for the Variances
y it x β it ui
it
With a consistent estimator of β, say bOLS ,
N 1 tT1 (y it - x b)2 estimates N 1 tT1 (2 U )
i
i
it i
i
2
2
Divide by something to estimate 2 = 2 U
With the LSDV estimates, ai and bLSDV ,
N 1 tT1 (y it - ai - x b)2 estimates N 1 tT12
i
i
it i
i
Divide by something to estimate 2
2 2
Estimate U with Est(2 U )- 2 .
ˆ
Feasible GLS
2
Feasible GLS requires (only) consistent estimators of 2 and u .
Candidates:
2 N 1 tT1 (y it ai x bLSDV )2
i
From the robust LSDV estimator:
ˆ i
N
it
i1 Ti K N
N 1 tT1 (y it aOLS x bOLS )2
2
i
2
From the pooled OLS estimator: Est( ) i
u
it
N 1 Ti K 1
i
2 2N 1 (y it a x bMEANS )2
From the group means regression: Est( / T ) i
u
i
N K 1
2 2 N 1 tT1 s t 1 w it wis
i Ti
ˆ ˆ
(Wooldridge) Based on E[w it w is | X i ] u if t s, u
ˆ i 1
N 1 Ti K N
i
There are many others.
x´ does not contain a constant term in the preceding.
Practical Problems with FGLS
2
All of the preceding regularly produce negative estimates of u .
Estimation is made very complicated in unbalanced panels.
A bulletproof solution (originally used in TSP, now LIMDEP and others).
N 1 tT1 (y it ai x bLSDV )2
i
2
From the robust LSDV estimator:
ˆ i
it
N 1 Ti
i
N 1 tT1 (y it aOLS x bOLS )2
2
i
2
From the pooled OLS estimator: Est( ) i
u
it
2
ˆ
N 1 Ti
i
2 N 1 tT1 (y it aOLS x bOLS )2 N 1 tT1 (y it ai x bLSDV )2
i i
ˆu
i it
N
i it
0
i1 Ti
x´ does not contain a constant term in the preceding.
Stata Variance Estimators
2 N 1 tT1 (y it ai x bLSDV )2
i
ˆ i
N
it
based on FE estimates
i1 Ti K N
2 SSE(group means) (N K)2 ˆ
u Max 0,
ˆ
N A (N A)T
2
where A = K or if u is negative,
ˆ
A=trace of a matrix that somewhat resembles IK .
Many other adjustments exist. None guaranteed to be
positive. No optimality properties or even guaranteed consistency.
Computing Variance Estimators
Using full list of variables (FEM and ED are time invariant)
OLS sum of squares = 522.2008.
2
Est(2 +u ) = 522.2008 / (4165 - 9) = 0.12565.
Using full list of variables and a generalized inverse (same
as dropping FEM and ED), LSDV sum of squares = 82.34912.
2 = 82.34912 / (4165 - 8-595) = 0.023119.
ˆ
2
u 0.12565 - 0.023119 = 0.10253
ˆ
2
Both estimators are positive. We can stop here. If u were
ˆ
negative, we would use estimators without DF corrections.
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
Testing for Effects: LM Test
Breusch and Pagan Lagrange Multiplier statistic
Assuming normality (and for convenience now, a
balanced panel)
2 2
NT (Tei )
N 2
NT [(Tei ) eei ]
N 2
LM=
i1
1
i1 i
2(T-1) tT1eit
N
i1
2
2(T-1) N 1eei
i i
Converges to chi-squared[1] under the null hypothesis
of no common effects. (For unbalanced panels, the
scale in front becomes (N 1 Ti )2 /[2N 1 Ti (Ti 1)].)
i i
Many adjustments for unbalanced panels and "better small
sample performance," e.g., Baltagi and Li in NLOGIT.
LM Tests
+--------------------------------------------------+
| Random Effects Model: v(i,t) = e(i,t) + u(i) | Unbalanced Panel
| Estimates: Var[e] = .216794D+02 | #(T=1) = 1525
| Var[u] = .958560D+01 | #(T=2) = 1079
| Corr[v(i,t),v(i,s)] = .306592 | #(T=3) = 825
| Lagrange Multiplier Test vs. Model (3) = 4419.33 | #(T=4) = 926
| ( 1 df, prob value = .000000) | #(T=5) = 1051
| (High values of LM favor FEM/REM over CR model.) | #(T=6) = 1200
| Baltagi-Li form of LM Statistic = 1618.75 | #(T=7) = 887
+--------------------------------------------------+
+--------------------------------------------------+
| Random Effects Model: v(i,t) = e(i,t) + u(i) |
| Estimates: Var[e] = .210257D+02 | Balanced Panel
| Var[u] = .860646D+01 | T = 7
| 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 |
+--------------------------------------------------+
REGRESS ; Lhs=docvis ; Rhs=one,hhninc,age,female,educ ; panel ; pds=_groupti $
Testing for Effects: Moments
Wooldridge (page 265) suggests based on the off diagonal elements
T-1 T
N t=1s=t+1eit eis
Z= i=1
2
N T-1 T
i=1 t=1 e eis
s=t+1 it
which converges to standard normal. ("We are not assuming any
particular distribution for the it . Instead, we derive a similar test that
has the advantage of being valid for any distribution...") It's convenient
to examine Z 2 which, by the Slutsky theorem converges (also) to chi-
squared with one degree of freedom.
Testing (2)
T-1 T
t=1 s=t+1eit eis = 1/2 of the sum of all off diagonal elements of
of eie or 1/2 the sum of all the elements minus the diagonal elements.
i
t=1 s=t+1eit eis =1/2[i(eie)i eei ]. But, iei = T ei . So,
T-1 T
i i
t=1 s=t+1eit eis = (1/2)[(T ei )2 eei ]
T-1 T
i
2
2
N 1 [(T ei )2 eei ]
i i 2(T 1) [N 1eei ]2
Z LM i i
N 1 [(T ei )2 eei ]2
i i NT i1 [(T ei ) eei ]2
N 2
i
Note, also
N 1ri N r
Z= i
, where ri (T ei )2 eei .
i
N 1ri2
i
sr
The claim that one function of [ei , eei ]i1,...,N is more valid than the other
i
seems a little dubious.
Application: Cornwell-Rupert
Testing for Effects
? Obtain OLS residuals
Regress; lhs=lwage;rhs=fixedx,varyingx;res=e$
? Vector of group sums of residuals
Matrix ; tebar=7*gxbr(e,person)$
? Direct computation of LM statistic
Calc ; list;lm=595*7/(2*(7-1))*
(tebar'tebar/sumsqdev - 1)^2$
? Wooldridge chi squared (N(0,1) squared)
Create ; e2=e*e$
Matrix ; e2i=7*gxbr(e2,person)$
Matrix ; ri=dirp(tebar,tebar)-e2i$
Matrix ; sumri=ri'1$
Calc ; list;z2=(sumri)^2/ri'ri$
LM = .37970675705025540D+04
Z2 = .16533465085356830D+03
Two Way Random Effects Model
y it x ui v t it
it
How to estimate the variance components?
(1) Two way FEM residual variance estimates 2
2
(2) Simple OLS residual variance estimates 2 u 2
v
(3) There are numerous ways to get a third equation.
E.g., the one way FEM residual variance in either dimension
One way FEM based on groups estimates (2 2 ) /(1 1 / T)
v
E.g., the group mean regressions in either dimension.
2
Based on group means estimates u (2 2 )/T
v
(Period means regression may have a tiny number of observations.)
(And a whole library of others - see Baltagi, sec. 3.3.)
Negative estimators of common variances are common.
Solutions are complicated.
One Way REM
+--------------------------------------------------+
| Random Effects Model: v(i,t) = e(i,t) + u(i) |
| Estimates: Var[e] = .0668628 |
| Var[u] = .0726096 |
| Corr[v(i,t),v(i,s)] = .520602 |
| Lagrange Multiplier Test vs. Model (3) = 3125.58 |
| ( 1 df, prob value = .000000) |
+--------------------------------------------------+
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
WKS | .00159346 .00097991 1.626 .1039 46.8115246
OCC | -.11950533 .01947798 -6.135 .0000 .51116447
IND | .05312497 .01877477 2.830 .0047 .39543818
SOUTH | -.08108168 .02447416 -3.313 .0009 .29027611
SMSA | .06763259 .02070533 3.266 .0011 .65378151
MS | -.00957703 .02703049 -.354 .7231 .81440576
FEM | -.44918001 .04512643 -9.954 .0000 .11260504
UNION | .07865185 .01904248 4.130 .0000 .36398559
ED | .05247613 .00488996 10.731 .0000 12.8453782
BLK | -.13774497 .04737233 -2.908 .0036 .07226891
Constant| 5.98678270 .08881086 67.410 .0000
Two Way REM
+----------------------------------------------------------+
| Random Effects Model: v(i,t) = e(i,t) + u(i) + w(t) |
| Estimates: Var[e] = .0232838 (.0668628) |
| Var[u] = .0618548 (.0726096) |
| Var[w] = .0543338 (.0000000) |
| Corr[v(i,t),v(i,s)] = .726519 |
| Corr[v(i,t),v(j,t)] = .700019 |
| Lagrange Multiplier Test vs. Model (3) =93416.98 |
+----------------------------------------------------------+
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
WKS | .00116797 .00059199 1.973 .0485 46.8115246
OCC | -.05385925 .01264036 -4.261 .0000 .51116447
IND | .03775548 .01300713 2.903 .0037 .39543818
SOUTH | -.07093664 .01957160 -3.624 .0003 .29027611
SMSA | .05803681 .01500299 3.868 .0001 .65378151
MS | -.00242497 .01748279 -.139 .8897 .81440576
FEM | -.44343656 .03740289 -11.856 .0000 .11260504
UNION | .04577568 .01290976 3.546 .0004 .36398559
ED | .05809106 .00412928 14.068 .0000 12.8453782
BLK | -.13918280 .04201095 -3.313 .0009 .07226891
Constant| 5.91602424 .11053610 53.521 .0000
Hausman Test for FE vs. RE
Estimator Random Effects Fixed Effects
E[ci|Xi] = 0 E[ci|Xi] ≠ 0
FGLS Consistent and Inconsistent
(Random Effects) Efficient
LSDV Consistent Consistent
(Fixed Effects) Inefficient Possibly Efficient
Hausman Test for Effects
ˆ ˆ
Basis for the test, βFE - βRE
ˆ ˆ ˆ
Wald Criterion: q = βFE - βRE ; W = q[Var(q)]-1q
ˆ ˆ ˆ
A lemma (Hausman (1978)): Under the null hypothesis (RE)
ˆ d
nT[βRE - β] N[0,VRE ] (efficient)
ˆ d
nT[βFE - β] N[0,VFE ] (inefficient)
ˆ ˆ ˆ
Note: q = (βFE - β)-(βRE β). The lemma states that in the
ˆ
joint limiting distribution of nT[ βRE - β] and ˆ
nT q , the
limiting covariance, C Q,RE is 0. But, C Q,RE = CFE,RE - VRE . Then,
Var[q] = VFE + VRE - CFE,RE - C . Using the lemma, CFE,RE = VRE.
FE,RE
It follows that Var[q]=VFE - VRE. Based on the preceding
ˆ ˆ ˆ ˆ ˆ ˆ
H=(βFE - βRE ) [Est.Var(βFE ) - Est.Var(βRE )]-1 (βFE - βRE )
β does not contain the constant term in the preceding.
Computing the Hausman Statistic
1
ˆ ] 2 N X I 1 ii X
Est.Var[βFE ˆ i1 i i
Ti
-1
N ˆi
Tiu
ˆ
2
ˆ
Est.Var[βRE ] i1 X I ii X i , 0 ˆi = 2
ˆ
2
1
i 2
Ti Tiu
ˆ ˆ
2 ˆ ˆ
As long as 2 and u are consistent, as N , Est.Var[βFE ] Est.Var[βRE ]
ˆ ˆ
will be nonnegative definite. In a finite sample, to ensure this, both must
be computed using the same estimate of 2 . The one based on LSDV will
ˆ
generally be the better choice.
ˆ
Note that columns of zeros will appear in Est.Var[βFE ] if there are time
invariant variables in X.
β does not contain the constant term in the preceding.
Hausman Test
+--------------------------------------------------+
| Random Effects Model: v(i,t) = e(i,t) + u(i) |
| Estimates: Var[e] = .235236D-01 |
| Var[u] = .133156D+00 |
| Corr[v(i,t),v(i,s)] = .849862 |
| Lagrange Multiplier Test vs. Model (3) = 4061.11 |
| ( 1 df, prob value = .000000) |
| (High values of LM favor FEM/REM over CR model.) |
| Fixed vs. Random Effects (Hausman) = 2632.34 |
| ( 4 df, prob value = .000000) |
| (High (low) values of H favor FEM (REM).) |
+--------------------------------------------------+
A Variable Addition Test
Asymptotic 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.
Application
Sample ; all$
? Fixed Effects Regression. Note, ED,BLK,FEM are time invariant.
regress; lhs = lwage
; rhs = wks,occ,ind,south,smsa,union,exp,expsq,ed,blk,fem
; pds = 7;panel;fixed$
? Pick up coefficients and variance from fixed effects model.
matrix; bf=b(1:8) ; vf=varb(1:8,1:8)$
? Random Effects Regression. Computed automatically.
regress; lhs = lwage
; rhs = wks,occ,ind,south,smsa,union,exp,expsq,ed,blk,fem
; pds = 7;panel$
? Pick up REM coefficients and variance then compute Hausman statistic
matrix; br=b(1:8) ; vr=varb(1:8,1:8)$
matrix ; db = bf - br ; dv = vf - vr $
matrix ; list ; h =db'db$
Fixed Effects
+----------------------------------------------------+
| Panel:Groups Empty 0, Valid data 595 |
| Smallest 7, Largest 7 |
| Average group size 7.00 |
| There are 3 vars. with no within group variation. |
| ED BLK FEM |
| Look for huge standard errors and fixed parameters.|
| F.E. results are based on a generalized inverse. |
| They will be highly erratic. (Problematic model.) |
| Unable to compute std.errors for dummy var. coeffs.|
+----------------------------------------------------+
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
|WKS | .00083 .00060003 1.381 .1672 46.811525|
|OCC | -.02157 .01379216 -1.564 .1178 .5111645|
|IND | .01888 .01545450 1.221 .2219 .3954382|
|SOUTH | .00039 .03429053 .011 .9909 .2902761|
|SMSA | -.04451** .01939659 -2.295 .0217 .6537815|
|UNION | .03274** .01493217 2.192 .0283 .3639856|
|EXP | .11327*** .00247221 45.819 .0000 19.853782|
|EXPSQ | -.00042*** .546283D-04 -7.664 .0000 514.40504|
|ED | .000 ......(Fixed Parameter)....... |
|BLK | .000 ......(Fixed Parameter)....... |
|FEM | .000 ......(Fixed Parameter)....... |
+--------+------------------------------------------------------------+
Random Effects
+--------------------------------------------------+
| Random Effects Model: v(i,t) = e(i,t) + u(i) |
| Estimates: Var[e] = .231312D-01 |
| Var[u] = .990559D-01 |
| Corr[v(i,t),v(i,s)] = .810690 |
| Lagrange Multiplier Test vs. Model (3) = 3543.36 |
| ( 1 df, prob value = .000000) |
| (High values of LM favor FEM/REM over CR model.) |
+--------------------------------------------------+
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
|WKS | .00094 .00059308 1.586 .1128 46.811525|
|OCC | -.04367*** .01299206 -3.361 .0008 .5111645|
|IND | .00271 .01373256 .197 .8434 .3954382|
|SOUTH | -.00664 .02246416 -.295 .7677 .2902761|
|SMSA | -.03117* .01615455 -1.930 .0536 .6537815|
|UNION | .05802*** .01349982 4.298 .0000 .3639856|
|EXP | .08744*** .00224705 38.913 .0000 19.853782|
|EXPSQ | -.00076*** .495876D-04 -15.411 .0000 514.40504|
|ED | .10724*** .00511463 20.967 .0000 12.845378|
|BLK | -.21178*** .05252013 -4.032 .0001 .0722689|
|FEM | -.24786*** .04283536 -5.786 .0000 .1126050|
|Constant| 3.97756*** .08178139 48.637 .0000 |
+--------+------------------------------------------------------------+
Hausman Test
--> matrix; br=b(1:8) ; vr=varb(1:8,1:8)$
--> matrix ; db = bf - br ; dv = vf - vr $
--> matrix ; list ; h =db'db$
Matrix H has 1 rows and 1 columns.
1
+--------------
1| 2523.64910
--> calc;list;ctb(.95,8)$
+------------------------------------+
| Listed Calculator Results |
+------------------------------------+
Result = 15.507313
Application: Wu Test
? Compute group means for Wu's variable addition test.
create ; wksb=groupmean(wks,pds=7)$
create ; occb=groupmean(occ,pds=7)$
create ; indb=groupmean(ind,pds=7)$
create ; southb=groupmean(south,pds=7)$
create ; smsab=groupmean(smsa,pds=7)$
create ; unionb=groupmean(union,pds=7)$
create ; expb=groupmean(exp,pds=7)$
create ; expsqb=groupmean(expsq,pds=7)$
? Random effects model with group means of time varying variables
regress; lhs = lwage
; rhs = wks,occ,ind,south,smsa,union,exp,expsq,ed,blk,fem,
wksb,occb,indb,southb,smsab,unionb,expb,expsqb
; pds=7;panel$
? Wald test of hypothesis that coefficients on the means are zero.
matrix ; bm=b(12:19);vm=varb(12:19,12:19)$
matrix ; list ; wu = bm'bm $
Means Added
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
|WKS | .00083 .00060070 1.380 .1677 46.811525|
|OCC | -.02157 .01380769 -1.562 .1182 .5111645|
|IND | .01888 .01547189 1.220 .2224 .3954382|
|SOUTH | .00039 .03432914 .011 .9909 .2902761|
|SMSA | -.04451** .01941842 -2.292 .0219 .6537815|
|UNION | .03274** .01494898 2.190 .0285 .3639856|
|EXP | .11327*** .00247500 45.768 .0000 19.853782|
|EXPSQ | -.00042*** .546898D-04 -7.655 .0000 514.40504|
|ED | .05199*** .00552893 9.404 .0000 12.845378|
|BLK | -.16983*** .04456572 -3.811 .0001 .0722689|
|FEM | -.41306*** .03732204 -11.067 .0000 .1126050|
|WKSB | .00863** .00363907 2.371 .0177 46.811525|
|OCCB | -.14656*** .03640885 -4.025 .0001 .5111645|
|INDB | .04142 .02976363 1.392 .1640 .3954382|
|SOUTHB | -.05551 .04297816 -1.292 .1965 .2902761|
|SMSAB | .21607*** .03213205 6.724 .0000 .6537815|
|UNIONB | .08152** .03266438 2.496 .0126 .3639856|
|EXPB | -.08005*** .00533603 -15.002 .0000 19.853782|
|EXPSQB | -.00017 .00011763 -1.416 .1567 514.40504|
|Constant| 5.19036*** .20147201 25.762 .0000 |
+--------+------------------------------------------------------------+
Wu (Variable Addition) Test
--> matrix ; bm=b(12:19);vm=varb(12:19,12:19)$
--> matrix ; list ; wu = bm'bm $
Matrix WU has 1 rows and 1 columns.
1
+--------------
1| 3004.38076
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 = *Gmmw(xwu,ewu,_stratum)*
; Stat(b,RobustVc,Xwu) $
Matrix ; Means = b(12:19);Vmeans=RobustVC(12:19,12:19)
; List ; RobustW=Means'Means $
Robust Standard Errors
+--------+--------------+----------------+ +--------+--------------+
|Variable| Coefficient | Standard Error | |Variable|Standard Error|
+--------+--------------+----------------+ +--------+--------------+
|WKS | .00083 .00060070 |WKS |.00086319
|OCC | -.02157 .01380769 |OCC |.01877775 Matrix ROBUSTW has
|IND | .01888 .01547189 |IND |.02268776
1 rows and 1
|SOUTH | .00039 .03432914 |SOUTH |.08889931
|SMSA | -.04451** .01941842 |SMSA |.02947711 columns.
|UNION | .03274** .01494898 |UNION |.02500498 2253.97002
|EXP | .11327*** .00247500 |EXP |.00404305
|EXPSQ | -.00042*** .546898D-04 |EXPSQ |.823659D-04
|ED | .05199*** .00552893 |ED |.00587385
|BLK | -.16983*** .04456572 |BLK |.04488235
|FEM | -.41306*** .03732204 |FEM |.03062920
|WKSB | .00863** .00363907 |WKSB |.00359870
|OCCB | -.14656*** .03640885 |OCCB |.03800966
|INDB | .04142 .02976363 |INDB |.03503648
|SOUTHB | -.05551 .04297816 |SOUTHB |.09321915
|SMSAB | .21607*** .03213205 |SMSAB |.03863529
|UNIONB | .08152** .03266438 |UNIONB |.03857305
|EXPB | -.08005*** .00533603 |EXPB |.00616803
|EXPSQB | -.00017 .00011763 |EXPSQB |.00013248
|Constant| 5.19036*** .20147201 |Constant|.20601042
+--------+------------------------------ +--------+----------
Fixed vs. Random Effects
-1
ˆ
ˆ
ˆ
βModel N 1 X I i,Model ii X i N 1 X I i,Model ii y i
i i i i
Ti Ti
ˆModel 1 for fixed effects.
2
Tiu
ˆ
ˆi,Model 2 2
for random effects.
Tiu
ˆ ˆ
As Ti , ˆi,RE 1, random effects becomes fixed effects
2
As u 0, ˆi,RE 0, random effects becomes OLS (of course)
ˆ
2
As u , ˆi,RE 1, random effects becomes fixed effects
ˆ
2
For the C&R application, u =.133156, 2 =.0235231, ˆ .975384.
ˆ ˆ
Looks like a fixed effects model. Note the Hausman statistic agrees.
β does not contain the constant term in the preceding.