William Greene
Department of Economics
Stern School of Business
Part 4: Fixed Effects [ 2/74]
http://people.stern.nyu.edu/wgreene/Econometrics/Bell-Jones-Fixed-vs-Random-Sept-2013.pdf
Part 4: Fixed Effects [ 3/74]
See Baltagi (2001, p. 24) for analysis of these data. The article on which the
analysis is based is Baltagi, B. and Griffin, J., "Gasoline Demand in the OECD: An
Application of Pooling and Testing Procedures," European Economic Review, 22,
1983, pp. 117-137. The data were downloaded from the website for Baltagi's
text.
Part 4: Fixed Effects [ 6/74]
Analysis of Variance
Part 4: Fixed Effects [ 7/74]
X1 d1 0 0 (T1 rows)
X 0 d2 0 (T2 rows)
2
X D X 3 0 0 d3 (T3 rows)
0
X N 0 0 0 dN (TN rows)
X i1 i2 iN i=1Ti rows
N
Part 4: Fixed Effects [ 10/74]
M1D 0 0
2
0 M 0
MD D (The dummy variables are orthogonal)
N
0 0 MD
MDi I Ti di (didi ) 1 di = I Ti (1/Ti )didi
1
X MD X = X [M0 I]X and b = X [M0 I]X X [M0 I]y.
Part 4: Fixed Effects [ 12/74]
LSDV Results
Pooled OLS
Part 4: Fixed Effects [ 17/74]
Different Normalizations
Separate constants: using D
Overall constant and N-1 constrasts
Overall constant, N constants, i i = 0
y=Xβ+Dα+ε
=Xβ+Cα * +ε
1
= y, so Cα* = Dα = (DP)(P α)
Part 4: Fixed Effects [ 18/74]
Renormalizing Fixed Effects
N Dummy Variables vs. a Constant and N-1 Dummy
Variables
Use 4 groups for example
i 0 0 0
0 i 0 0
D estimates a=α ,α ,...,α
0 0 i 0 1 2 N
0 0 0 i
i 0 0 0 1 0 0 0 1 0 0 0
1 1 0 0
i i 0 0 1 1 0 0
C D DP P 1
i 0 i 0 1 0 1 0 1 0 1 0
i 0 0 i 1 0 0 1 1 0 0 1
y y
N Ti 2
Conventional: Total Sum of Squares = i 1 t 1 it R2 = 0.90542 areg
y yi
N Ti 2
"Within Sum of Squares" = i 1 t 1 it R2 = 0.65142 xtreg fe
The coefficient estimates and standard errors are the same. The calculation of the R 2 is different. In the
areg procedure, you are estimating coefficients for each of your covariates plus each dummy
variable for your groups. In the xtreg, fe procedure the R reported is obtained by only fitting a
2
mean deviated model where the effects of the groups (all of the dummy variables) are assumed to be
fixed quantities. So, all of the effects for the groups are simply subtracted out of the model and no
attempt is made to quantify their overall effect on the fit of the model.
Since the SSE is the same, the R2=1−SSE/SST is very different. The difference is real in that we are
making different assumptions with the two approaches. In the xtreg, fe approach, the effects of the
groups are fixed and unestimated quantities are subtracted out of the model before the fit is
performed. In the areg approach, the group effects are estimated and affect the total sum of squares of
the model under consideration.
Part 4: Fixed Effects [ 25/74]
.8 5 6 1 .6 8 8 2 .5 2 0 3 .3 5 1 4 .1 8 3 5 .0 1 5 5 .8 4 7 6 .6 7 8
AI
Part 4: Fixed Effects [ 26/74]
1 1 x x *
f̂(xm ) i1 K
* n *
, for a set or points x m
i m
n h h
h "bandwidth" chosen by the analyst. A common
choice is Silverman's rule of thumb = 1.06ˆ x /n1/5
K the kernel function, such as the normal
or logistic density (or one of several others)
x* the point at which the density is approximated.
Part 4: Fixed Effects [ 27/74]
.2 7 6
.2 0 7
Frequency
De ns ity
.1 3 8
.0 6 9
.0 0 0
0 1 2 3 4 5 6 7
AI
.8 5 6 1 .6 8 8 2 .5 2 0 3 .3 5 1 4 .1 8 3 5 .0 1 5 5 .8 4 7 6 .6 7 8
Ke rn e l d e n s i ty e s ti m a te fo r AI
AI
CREATE ; ID=TRN(7,0)$
SETPANEL ; GROUP=ID $
REGRESS ;lhs=lwage;rhs=occ,smsa,ms,exp ; panel ; fixed $
? Creates 595 by 1 matrix named ALPHAFE
HISTOGRAM; rhs=alphafe ;title=Fixed Effects from Cornwell and Rupert Wage Model$
KERNEL;rhs=alphafe ; title=Fixed Effects from Cornwell and Rupert Wage Model$
Part 4: Fixed Effects [ 29/74]
Part 4: Fixed Effects [ 30/74]
Part 4: Fixed Effects [ 31/74]
Part 4: Fixed Effects [ 32/74]
i=1 Ti i=1 Ti
which is the usual estimator for OLS
2
Ti
Ni=1 t=1 (y it -ai -x itb)2
ˆ
N
i=1 Ti - N - K
(Note the degrees of freedom correction)
Part 4: Fixed Effects [ 35/74]
Asymptotics for ai
LSDV is an IV Estimator
y it x it β c i +εit
x it β (c i +εit )
x it β wit
Cov[x it , wit ] Cov[x it ,(c i +εit )] g(x it ) 0
x it is correlated with the FEs embedded in wit
Part 4: Fixed Effects [ 40/74]
1
X X 1
t=1 it i
N Ti
= β plim N plim N x c
i=1 Ti i=1 Ti
i=1
1
X X N Ti 1
= β plim N plim i=1 N t 1 xit
Ti
ci
i=1 Ti i=1 Ti Ti
1
X X N T
= β plim N plim i=1 N i c i x i.
i=1 Ti i=1 Ti
1
X X
= β plim N plim i=1 fic i x i. 0 < fi < 1, Ni=1 fi 1
N
i=1 Ti
T 1
Note N i = if balanced panel
i=1 Ti N
Part 4: Fixed Effects [ 41/74]
M1D 0 0
2
0 M 0
MD D (The dummy variables are orthogonal)
N
0 0 M D
Define Z = MD X.
1
bLSDV ZX Zy (Looks like an IV estimator.)
ZX
(1) Plim 0?
Σ i Ti
k,l
Plim X iMDi X i t=1
T
i
(x it,k -x i.,k )(x it,l -x i.,l )
The problem here is the estimator of the disturbance variance. The matrix is OK.
Note, for example, .01374007/.01950085 (top panel)
= .16510 /.23432 (bottom panel).
Part 4: Fixed Effects [ 48/74]
Part 4: Fixed Effects [ 49/74]
ML Estimation (cont.)
2 2 (Ni1 Ti ) N K 2 1 K 2 1 N K
E[
ˆ ]
N 1 N 1 N
T
i1 i T T
i1 T
2
This is a 'regular' problem, so ˆ converges to a
probability limit - it is consistent for something. Note, as
2 2
N increases,
ˆ converges to [1 - 1/T]. T (or Ti ) is
2
fixed in this model. So,
ˆ is not a consistent estimator
of 2 unless T increases. Suppose Ti 2. Then
2 2
plim
ˆ . The inconsistency does not go away as N
2
increases.
This is THE example of the Incidental Parameters Problem.
(Neyman and Scott (1948). It occurs because the
number of parameters being estimated is growing as N grows.
Part 4: Fixed Effects [ 52/74]
+--------------------------------------------------------------------+
| Test Statistics for the Classical Model |
+--------------------------------------------------------------------+
| Model Log-Likelihood Sum of Squares R-squared |
|(1) Constant term only -2688.80597 886.90494 .00000 |
|(2) Group effects only 27.58464 240.65119 .72866 |
|(3) X - variables only -1688.12010 548.51596 .38154 |
|(4) X and group effects 2223.20087 83.85013 .90546 |
+--------------------------------------------------------------------+
μ̂=y-xb
α̂i * (y i. y) ( x i. x)b
ˆ t * (y.t y) ( x.t x)b
Part 4: Fixed Effects [ 58/74]
Ti
z.i z t 1 it
Nt
z.t z
i1 it
Part 4: Fixed Effects [ 61/74]
N Ti ( x - x . - x. x )(y - y . - y. y)
i1 t 1 it i t it i t
μ̂ = y-x b
α̂i * (y i . y) ( x i . x )b
ˆ t * (y.t y) ( x.t x)b
The model must be fit as a one way FEM with time
dummy variables
Part 4: Fixed Effects [ 62/74]
Mundlak’s Approach
A “Hierarchical” Model
Application
Federal Reserve Board, Division of Research &
Statistics and Monetary Affairs, 2004, rev.
1/2005
An Algebraic Aspect
Ji is not quite a group dummy variable. For the group, Ji
is one for some members of the group – those with a
“jumbo” mortgage.
The Model
Step 2
Step 3
Regress yit on a constant, X, Z and h using
ordinary least squares to estimate α, β, γ, δ.
The Turn:
Based on Cornwell and Rupert
namelist ; x = exp,wks,occ,ind,south,smsa,union
; z = fem,ed $
(1) Step 1.
regress ; lhs=lwage;rhs=x,z;panel;fixed;pds=7 $
create ; uhi = alphafe(_stratum) $
(2) Step 2
regress ; lhs = uhi ; rhs = one,z ; res = hi $
(3) Step 3.
regress ; lhs = lwage ; rhs = one,x,z,hi $
Part 4: Fixed Effects [ 84/74]
--------+---------------------------------------------------------
| Standard Prob. Mean
UHI| Coefficient Error z z>|Z| of X
--------+---------------------------------------------------------
Constant| 2.88090*** .07172 40.17 .0000
FEM| -.09963** .04842 -2.06 .0396 .11261
ED| .14616*** .00541 27.02 .0000 12.8454
--------+---------------------------------------------------------
Part 4: Fixed Effects [ 86/74]
Step 3!
--------+---------------------------------------------------------
| Standard Prob. Mean
LWAGE| Coefficient Error z z>|Z| of X
--------+---------------------------------------------------------
Constant| 2.88090*** .03282 87.78 .0000
EXP| .09663*** .00061 157.53 .0000 19.8538
WKS| .00114*** .00044 2.58 .0098 46.8115
OCC| -.02496*** .00601 -4.16 .0000 .51116
IND| .02042*** .00479 4.26 .0000 .39544
SOUTH| -.00091 .00510 -.18 .8590 .29028
SMSA| -.04581*** .00506 -9.06 .0000 .65378
UNION| .03411*** .00521 6.55 .0000 .36399
FEM| -.09963*** .00767 -13.00 .0000 .11261
ED| .14616*** .00122 120.19 .0000 12.8454
HI| 1.00000*** .00670 149.26 .0000 -.103D-13
--------+---------------------------------------------------------
Part 4: Fixed Effects [ 87/74]
Part 4: Fixed Effects [ 88/74]
http://davegiles.blogspot.com/2012/06/fixed-effects-vector-decomposition.html
Part 4: Fixed Effects [ 91/74]
Balanced Panel
Balanced Panel
I T 0 0 1 I T 0 IT 0 IT
0 IT 0 0 I 1 IT 0 I T
INT = = T
= IN I T
0 0 IT 0 I T 0 IT 1 IT
1 I T - 1 JT 0 I T 0 JT 0 I T 0 JT
0 I T 0 JT 1 I T - 1 JT 0 I T 0 JT
INT -P =
0 I T 0 JT 0 I T 0 JT 1 I T - 1 JT
IN I T IN JT IN I T - JT Q
Part 4: Fixed Effects [ 97/74]
Balanced Panel
1 JT 0 JT 0 JT X 1 X 1
0 JT 1 JT 0 JT X 2 X 2 This is T rows each
PX =
with means repeated.
0 JT 0 JT 1 JT X N X N
PX = I J X
X1 X1
X
2 X 2 This is T rows each
QX = X - I J X =
with mean deviations.
X N X N
Part 4: Fixed Effects [ 98/74]
Balanced Panel
QX = X - IN JT X
= INT X - IN JT X
= IN I T X - IN JT X
X1 X1
X
2 X 2 This is T rows each
= QX
with mean deviations
X N X N
1
bLSDV X QX X Qy
Part 4: Fixed Effects [ 99/74]
Balanced Panel
JT 0 0
0 J 0
P is T ; PX creates group means
0 0 JT
I - JT 0 0
0 I - J 0 I I - 1 dd
Q is T
T
N
0 0 I - JT
Homework:
(1) Verify that both P and Q are idempotent
(2) Show that PQ = 0
(3) What is the trace of Q?