Vous êtes sur la page 1sur 99

Part 4: Fixed Effects [ 1/74]

Econometric Analysis of Panel Data

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]

Fixed Effects Models


The fixed effects model
y it =x itβ+c i +εit , observation for person i at time t
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 +ε , Ni=1 Ti observations in the sample
c=(c1 , c2 ,...cN ), Ni=1 Ti by 1 vector

ci is arbitrarily correlated with xit but E[εit|Xi,ci]=0


Dummy variable representation
yit =xitβ+Nj=1 jdijt +εit , dijt = 1(i=j)
Part 4: Fixed Effects [ 4/74]

Useful Analysis of Variance Notation

Decomposition of Total variation:


2
N
Σ Σ Ti 2
(zit  z)  Σ N
Σ Ti
(zit  zi .)   Σ Ti  zi .  z 
2 N
i=1 t=1 i=1  t=1 i=1

Total variation = Within groups variation


+ Between groups variation
Part 4: Fixed Effects [ 5/74]

Baltagi and Griffin’s Gasoline Data


World Gasoline Demand Data, 18 OECD Countries, 19 years
Variables in the file are

COUNTRY = name of country


YEAR = year, 1960-1978
LGASPCAR = log of consumption per car
LINCOMEP = log of per capita income
LRPMG = log of real price of gasoline
LCARPCAP = log of per capita number of cars

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]

The Analysis of Variance


Part 4: Fixed Effects [ 8/74]

The Fixed Effects Model

yi = Xi + diαi + εi, for each individual


 y1   X1 d1 0 0 0
  X
 y2    2 0 d2 0 0   β 
ε
     α 
   
 yN   X N 0 0 0 dN 
β
= [X, D]    ε
 α
= Zδ  ε
E[ci | Xi ] = g(Xi); Effects are correlated with included variables.
Cov[xit,ci] ≠0
Part 4: Fixed Effects [ 9/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]

Estimating the Fixed Effects Model


 The FEM is a simple linear regression model but
with many independent variables
 Least squares estimator of  is unbiased,
consistent, efficient, but inconvenient if N is
large.
1
 b   X X X D   X y 
     Dy 
a
   D X D D   
Using the Frisch-Waugh theorem
b =[X MD X ]1 X MD y 
Part 4: Fixed Effects [ 11/74]

Fixed Effects Estimator (cont.)

M1D 0 0 
 2 
0 M 0
MD   D  (The dummy variables are orthogonal)
 
 N

 0 0 MD 
MDi  I Ti  di (didi ) 1 di = I Ti  (1/Ti )didi

X MD X = Ni=1 X iMDi X i ,  


X iMDi X i
k,l
T
  t=1
i
(x it,k -x i.,k )(x it,l -x i.,l )

X MD y = Ni=1 X iMDi y i , XM y 


i
i
D i k
i
T
  t=1 (x it,k -x i.,k )(y it -y i. )

If all groups have the same Ti , MD  M0  I where M0  I T  (1/T)dd

 
1
X MD X = X [M0  I]X and b = X [M0  I]X X [M0  I]y.
Part 4: Fixed Effects [ 12/74]

The Within Transformation


Removes the Effects
y it  xit β  ci +εit
y i  xiβ  ci +εi
y it  y i  ( xit - x i )β  (εit  εi )
y it  xit β  εit

Wooldridge notation for data in deviations from group means


Part 4: Fixed Effects [ 13/74]

Least Squares Dummy Variable Estimator


 b is obtained by ‘within’ groups least
squares (group mean deviations)
 Normal equations for a are D’Xb+D’Da=D’y
a = (D’D)-1D’(y – Xb)
ai=(1/Ti )Σ Ti
t=1 (yit -xitb)=ei

Notes: This is simple algebra – the estimator is just OLS


Least squares is an estimator, not a model. (Repeat twice.)
Note what ai is when Ti = 1. Follow this with yit-ai-xit’b=0 if Ti=1.
Part 4: Fixed Effects [ 14/74]

A Fixed Effects Log Wage Equation


EXP = work experience
WKS = weeks worked
OCC = occupation, 1 if blue collar,
IND = 1 if manufacturing industry
SOUTH = 1 if resides in south
SMSA = 1 if resides in a city (SMSA)
MS = 1 if married
FEM = 1 if female
UNION = 1 if wage set by union contract
ED = years of education
LWAGE = log of wage = dependent variable in regressions

ln Wageit  0  1Expit  2 Expit2  3Wksit  4Occit  5 Indit  6 Southit  7 SMSAit  8Unionit


+ 1 Femi   2 Edi + Other unobserved attributes of individuali
+ it
Are the other unobserved attributes likely to be correlated with the observed variables?
One possibility: Healthi probably correlated with Expit and Wksit. A fixed effects treatment would
be appropriate. (Motivation and Ability are the usual candidates here.)
Part 4: Fixed Effects [ 15/74]

Application Cornwell and Rupert


Part 4: Fixed Effects [ 16/74]

LSDV Results

Note huge changes in


the coefficients. SMSA
and MS change signs.
Significance changes
completely!

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

a*=P -1a = α1 , α2  α1 , α3  α1 ,..., αN  α1

Implication: No change in other coefficients, no change in sum of squares or R2


Part 4: Fixed Effects [ 19/74]

xtreg lx2ppii lx5ppii lx7ppii lx14 lx15,fe


Fixed-effects (within) regression Number of obs = 210
Group variable: id Number of groups = 30

R-sq: Obs per group:


within = 0.6875 min = 7
between = 0.5190 <***** avg = 7.0
overall = 0.5446 max = 7
F(4,176) = 96.78
corr(u_i, Xb) = -0.0122 (How to compute this?) Prob > F = 0.0000
------------------------------------------------------------------------------
lx2ppii | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
lx5ppii | .6814873 .0372348 18.30 0.000 .6080031 .7549715
lx7ppii | .0176203 .0192227 0.92 0.361 -.0203163 .055557
lx14 | -.1034633 .1198958 -0.86 0.389 -.3400818 .1331553
lx15 | -.0486583 .1786855 -0.27 0.786 -.4013003 .3039837
_cons | 3.23385 2.156826 1.50 0.136 -1.022721 7.490421
(Which constant term is this? Which one is omitted? First? Last?
-------------+----------------------------------------------------------------
sigma_u | .68475697 (How is this computed?)
sigma_e | .250843
rho | .88168388 (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(29, 176) = 20.77 Prob > F = 0.0000
Part 4: Fixed Effects [ 20/74]

The Effect of the Effects


Part 4: Fixed Effects [ 21/74]

Inside Baseball: 31 Teams, 16 years. Fans = a(i) + bWins(i,t) + e(i,t)


Part 4: Fixed Effects [ 22/74]

Inside Baseball: 31 Teams, 16 years. Fans = a(i) + bWins(i,t) + e(i,t)


Part 4: Fixed Effects [ 23/74]
Part 4: Fixed Effects [ 24/74]

A Caution About Stata and R2


Residual Sum of Squares
R squared = 1 -
Total Sum of Squares
For the FE model above,
Or is it? What is the total sum of squares?

  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

Which should appear in the denominator of R 2

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]

The Estimated Fixed Effects


Fixed E ffects fr om C or nw ell and R uper t W age Model
Frequency

.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]

A Kernel Density Estimator

1 1  x  x * 
f̂(xm )   i1 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]

Examining the Effects


with a KDE

Mean = 4.819, standard deviation = 1.054.


Part 4: Fixed Effects [ 28/74]

Histogram vs. KDE


Fixed E ffects fr om C or nw ell and R uper t W age Model
Fixed Effects from Cornwell and Rupert Wage Model
.3 4 5

.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]

Inside Baseball: 31 Teams, 16 years. Fans = a(i) + bWins(i,t) + e(i,t)


Part 4: Fixed Effects [ 33/74]

Robustness of the LSDV Estimator


 Under the full Gauss-Markov assumptions, b is
unbiased and consistent (and even efficient).
 If Var[εi] = Ωi ≠ε2ITi then b is consistent but
inefficient. (We’ll return to robust estimation
below.)
 Under all assumptions, Var[ai] is O(1/Ti).
ai is unbiased but inconsistent.
 Inconsistent not because it estimates the wrong
parameter, but because it converges to a random
variable, not a constant. Ti is not increasing.
Part 4: Fixed Effects [ 34/74]

Inference About OLS


 Assume strict exogeneity: Cov[εit,(xjs,cj)]=0. Every
disturbance in every period for each person is
uncorrelated with variables and effects for every person
and across periods.
 Now, it’s just least squares in a classical linear
regression model. 2 1
  1 
 Asy.Var[b] = N
plim  N i=1 X iMD X i 
N i

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]

Robust Counterpart to White Estimator?


Assumes Var[εi] = Ωi ≠2ITi
ei = yi – aiiTi - Xib = MDyi – MDXib
(Ti x 1 vector of group residuals)
1 1
Est.Asy.Var[b]= Ni=1XiMDi X i  Ni=1 (XiMDi ei )(eiMDi X i ) Ni=1XiMDi X i 
 
 H1 Ni=1  t=1

Ti
 
( x it  x i )eit  t=1 Ti

( xit  xi )eit  H1

H  Ni=1 t=1
Ti
( x it  x i )( x it  x i )

Resembles (and is based on) White, but treats a full vector of


disturbances at a time. Robust to heteroscedasticity and
autocorrelation (within the groups).
Part 4: Fixed Effects [ 36/74]

Robust Covariance Matrix for LSDV


Cluster Estimator for Within Estimator
Part 4: Fixed Effects [ 37/74]

A Caution About Stata and Fixed Effects


Part 4: Fixed Effects [ 38/74]

Asymptotics for ai

ai  (didi )1 di ( y i  X ib) from the LS normal equations


= y i  x ib
= (y i  x iβ) - x i (b-β)
= i + i - x i (b-β)
E[ai | X]  i  0  0 = i (b is unbiased)
Var[ai | X]  0  2 / Ti  x i Var[(b-β) | X]x i
limN E[ai | X]  i
limN Var[ai | X]  2 / Ti + 0 (b is consistent so Var[(b-β) | X]  0)
ai is not consistent. It is unbiased but its variance does not  0.
Part 4: Fixed Effects [ 39/74]

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]

y it  x it β  c i +εit (1 observation)


y i  X iβ  c i di +ε i (Ti observations)
y i  X iβ  wi (i Ti observations)
y  Xβ  w
plim(b)=plim  X X  X y
1

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

MDi  I Ti  di (didi )1 di = I Ti  (1/Ti )di di


X MD X = Ni=1 X iMDi X i , X M X 
i
i
D i k,l
i
T
  t=1 (x it,k -x i.,k )(x it,l -x i.,l )

X MD y = Ni=1 X iMDi y i , X M y 


i
i
D i k   t=1
i
T
(x it,k -x i.,k )(y it -y i. )
Part 4: Fixed Effects [ 42/74]

bLSDV   X MD  X   XMD  y


1

Define Z = MD X.
1
bLSDV  ZX  Zy (Looks like an IV estimator.)
 ZX 
(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 )

Nonsingular PD matrix if there is no multicollinearity and if


every column of X has within group variation.
 Zw   Zw   Σ i X iMDi (c ii  i ) 
(2) Plim   = 0 ? Plim    Plim  
Σ T
 i i Σ T
 i i  Σ T
i i 
c iMDi i = 0 because i has no within group variation
1
Σ i Ti
 
Plim Σ i X iMDi i  0 by the assumption of the model.
Part 4: Fixed Effects [ 43/74]

LSDV is a Control Function 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 .
LS regression of y on X is inconsistent because X is
correlated with w. We seek a control function h(.) such that
X|h(.) is uncorrelated with w. (In the presence of h(.), X is
not correlated with w.)
Using the Frisch-Waugh theorem
b =[X MD X ]1  X MD y 
Consider regression of y on [X ,X]. I.e., add group
means to the regression.
Part 4: Fixed Effects [ 44/74]

LSDV is a Control Function Estimator


Consider regression of y on [X ,X]. I.e., add group
means to the regression.
 x11 x12 x1K x11 .i1 x12 .i1 x11i1 
x x 22 x 2K x 21 .i2 x 22 .i2 x11i2 
[X ,X ]   21 
 
 
 xN1 x N2 x NK x N1 .iN x N2 .iN x NK .iN 
= [X, (I-MD )X ]
= [X , PD X]
= [X ,F]
Part 4: Fixed Effects [ 45/74]

LSDV is a Control Function Estimator


Using the Frisch-Waugh theorem
b ControlFunction =[X MF X ]1  X MF y 
X MF X  X [I  F(F F) 1 F ]X
 X [I  PD X ( X PDPD X )1 X PD ]X
PD is symmetric and idempotent. And PD = I-MD
 X [I  (I-MD ) X ( X (I-MD ) X ) 1 X (I-MD )]X
Multiply this out in full and collect some terms
=X IX -  X (I-MD ) X  X (I-MD ) X  X (I-MD ) X
1

The two large matrices cancel. One more step


=X X - X (I-MD ) X = X X - X X + X MD X
= X MD X. Likewise,  X MF y    X MD y  . Therefore,
b ControlFunction = bLSDV
Part 4: Fixed Effects [ 46/74]
Part 4: Fixed Effects [ 47/74]

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]

Generalized Least Squares?


If Var[εi] = Ωi ≠ε2ITi then b is consistent but
inefficient.
ˆ =[X Ω-1 X ]1 [X Ω-1 y ]
GLS : β
=[Ni=1 X iΩi-1 X i ]-1 [Ni=1 X iΩi-1 y i ]
Estimate Ω?
(1) Balanced panel case: (1/N)Ni=1eiei from fixed effects
(2) Unbalanced case? Put zeros in ei in appropriate places?

Elements of Ωˆ are now based on different T. i

Note Ωˆ is TxT with rank at most N. If T > N, Ω


ˆ is
singular and GLS cannot be computed. N will be >> T.
Part 4: Fixed Effects [ 50/74]

Maximum Likelihood Estimation


With normally distributed disturbances, the FE model is the
ordinary classical normal linear regression model. OLS is the
maximum likelihood estimator of β. The maximum likelihood
estimator of 2 is
N Ti 2
2   e

ˆ   i1 Ti t 1 it , the usual mean squared residual, with no
 t 1 Ti
correction for degrees of freedom. From standard results for
the linear model (e.g., Greene, p. 51), the exact expectation is
2  (Ni1 Ti )  N  K 
2 2  1 K  2  1  N  K 
E[
ˆ ]
   
 N     1   N     1   N 
  T
i1 i   T  T
i 1   T  
Part 4: Fixed Effects [ 51/74]

ML Estimation (cont.)
2 2 (Ni1 Ti )  N  K  2  1 K  2  1  N  K 
E[
ˆ ] 
  N      1   N     1   N 
  T
i1 i   T  T
i1   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]

Between Groups Estimator

Inconsistency of the group means estimator


y i  x iβ  c i +εi
= x iβ  w i
Cov[w i , x i ]  Cov[c i +εi , x ]
0
Part 4: Fixed Effects [ 53/74]

Time Invariant Regressors


 Time invariant xit is defined as invariant for all i.
E.g., SEX dummy variable. ED (education in the
Cornwell/Rupert data).
 If xit,k is invariant for all i, then xit,k = ihidi for
the set of dummy variables and some set of his.
 If xit,k is invariant for all i, then the group mean
deviations are all 0.
Part 4: Fixed Effects [ 54/74]

FE With Time Invariant Variables


+----------------------------------------------------+
| There are 2 vars. with no within group variation. |
| FEM ED |
+----------------------------------------------------+
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
EXP | .09671227 .00119137 81.177 .0000 19.8537815
WKS | .00118483 .00060357 1.963 .0496 46.8115246
OCC | -.02145609 .01375327 -1.560 .1187 .51116447
SMSA | -.04454343 .01946544 -2.288 .0221 .65378151
FEM | .000000 ......(Fixed Parameter).......
ED | .000000 ......(Fixed Parameter).......
+--------------------------------------------------------------------+
| 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 |
+--------------------------------------------------------------------+
Part 4: Fixed Effects [ 55/74]

Drop The Time Invariant Variables


Same Results
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
EXP | .09671227 .00119087 81.211 .0000 19.8537815
WKS | .00118483 .00060332 1.964 .0495 46.8115246
OCC | -.02145609 .01374749 -1.561 .1186 .51116447
SMSA | -.04454343 .01945725 -2.289 .0221 .65378151

+--------------------------------------------------------------------+
| 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 |
+--------------------------------------------------------------------+

No change in the sum of squared residuals


Part 4: Fixed Effects [ 56/74]

Two Way Fixed Effects


 A two way FE model. Individual dummy variables and time
dummy variables.
 yit = αi + t + xit’β + εit
 Normalization needed as the individual and time dummies both
sum to one. Reformulate model:
 yit = μ + αi* + t* + xit’β + εit with
i αi* =0, t t* = 0
 Full estimation: yit  yit  yi.  y.t  y
 Practical estimation. Add T-1 dummies
 Complication: Unbalanced panels are complicated
 Complication in recent applications: Vary large N and very large T
Part 4: Fixed Effects [ 57/74]

Fixed Effects Estimators


Slope estimators, as usual with transformed data

μ̂=y-xb
α̂i *  (y i.  y)  ( x i.  x)b
ˆ t *  (y.t  y)  ( x.t  x)b
Part 4: Fixed Effects [ 58/74]

Two Way Fixed Effects Application


Spanish Dairy Farms; N=247, T=6
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
No Effects
Constant| 11.5774868 .00364586 3175.515 .0000
X1 | .59517558 .01958331 30.392 .0000 0
X2 | .02305014 .01122274 2.054 .0400 0
X3 | .02319244 .01303099 1.780 .0751 0
X4 | .45175783 .01078465 41.889 .0000 0
Firm Dummies
X1 | .66200103 .02467845 26.825 .0000 0
X2 | .03735244 .01613309 2.315 .0206 0
X3 | .03039947 .02320776 1.310 .1902 0
X4 | .38251038 .01201690 31.831 .0000 0
Firm and Time Dummies
X1 | .63796531 .02379854 26.807 .0000 0
X2 | .04127557 .01544463 2.672 .0075 0
X3 | .02819226 .02217322 1.271 .2036 0
X4 | .30816028 .01322571 23.300 .0000 0
REGRESS ; Lhs = yit ; Rhs = one,x1,x2,x3,x4 ; pds=6 ; period=t $
Marginal changes in the estimates. Why?
Part 4: Fixed Effects [ 59/74]

Analysis of Variance (FIT)


+--------------------------------------------------------------------+
| Test Statistics for the Classical Model |
+--------------------------------------------------------------------+
| Model Log-Likelihood Sum of Squares R-squared |
|(1) Constant term only -1448.90832 .6131518321D+03 .0000000 |
|(2) Group effects only 412.25944 .4974526192D+02 .9188696 |
|(3) X - variables only 809.67611 .2909570093D+02 .9525473 |
|(4) X and group effects 1751.64437 .8161093811D+01 .9866899 |
|(5) X ind.&time effects 1826.23878 .7379537558D+01 .9879646 |
+--------------------------------------------------------------------+
| Hypothesis Tests |
| Likelihood Ratio Test F Tests |
| Chi-squared d.f. Prob. F num. denom. P value |
|(2) vs (1) 3722.336 246 .00000 56.859 246 1235 .00000 |
|(3) vs (1) 4517.169 4 .00000 7412.185 4 1477 .00000 |
|(4) vs (1) 6401.105 250 .00000 365.021 250 1231 .00000 |
|(4) vs (2) 2678.770 4 .00000 1568.114 4 1231 .00000 |
|(4) vs (3) 1883.937 246 .00000 12.836 246 1231 .00000 |
|(5) vs (4) 149.189 5 .00000 25.969 5 1226 .00000 |
|(5) vs (3) 2033.125 252 .00000 14.317 252 1226 .00000 |
+--------------------------------------------------------------------+
Part 4: Fixed Effects [ 60/74]

Unbalanced Panel Data


(First 10 households in healthcare data)

Ti
z.i   z t 1 it

Nt
z.t   z
i1 it
Part 4: Fixed Effects [ 61/74]

Two Way FE with Unbalanced Data


This computation is not appropriate in two way FE
models with unbalanced panels:
1
b=   i1  t 1 ( x it - x i . - x.t  x )( x it - x i . - x.t  x ) 
N Ti

 
  N  Ti ( x - x . - x.  x )(y - y . - y.  y) 
 i1 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]

y it  y it  y i.  y.t  y and likewise for x it .


Does not work correctly for unbalanced panels.
Fit two way models as one way with time dummies.
Part 4: Fixed Effects [ 63/74]

Textbook formula application. This is incorrect.

Two way fixed effects as one way with time dummies


Part 4: Fixed Effects [ 64/74]

Mundlak’s Approach

y it  x itβ+ziδ  c i +εit , (x does not contain a constant)


E[εit|X i , c i ]  0, Var[ε it|X i , c i ]=2
c i  + x i + w i ,
E[wi|X i , zi ]  0, Var[w i|X i , zi ]  2w
y it  x itβ  ziδ    x i  wi  εit
= random effects model including group means.
Part 4: Fixed Effects [ 65/74]

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
Estimates: Var[e] = .0235632
Var[u] = .0773825
Part 4: Fixed Effects [ 66/74]

A “Hierarchical” Model

Lower level structural model


y it  x itβ  c i +εit
Upper level model for effects
c i  ziδ + w i
How does this affect the fixed effects model?
y it  x itβ  αi +εit
No change in the model, but it invites a second step.
Part 4: Fixed Effects [ 67/74]

Estimating a Hierarchical Model


 Classical assumptions at both levels
y it  x itβ  c i +εit , E[εit|X i , ci ]  0, Var[εit|X i , c i ]=2 , etc.
c i  ziδ + w i , E[w i|zi ]  0, Var[w i|zi ]=2w

 Two step estimation


 Fixed effects, dummy variables at top level
 Regress ai on zi to estimate δ at the 2nd level. The regression
is heteroscedastic. Use OLS/White or Weighted LS with
ˆi  ci )  ci  v i  ziδ  (wi  v i )
ai  ci  (c
Asy.Var[ai | Xi , zi ]  [ 2 / Ti ]  xit (I - MDi )Asy.Var[b](I  MDi ) x it
= [ 2 / Ti ]  xi Asy.Var[b]xi
Part 4: Fixed Effects [ 68/74]

A Two Step Regression


Sample ; all$
Create ; person=trn(7,0) ; year=trn(-7,0)$
Namelist; varyingX=occ,smsa,ms,exp$
Namelist; fixedX=one,fem,ed$
? FE regression to compute dummy variable coefficients
Regress ; lhs=lwage ; rhs=varyingX ; panel ; fixed ; pds=7$
Create ; ai=alphafe(person)$
Create ; occb= GroupMean(occ,pds=7)$
Create ; msb = GroupMean(ms,pds=7)$
Create ; smsab=GroupMean(smsa,pds=7)$
Create ; expb= GroupMean(exp,pds=7)$
? Standard errors for dummy variable coefficient estimates
Namelist; means=occb,smsab,msb,expb$
Create ; varai=ssqrd/_Groupti + qfr(means,varb) ; wt=1/varai$
? Weighted least squares regression of dummy variable coefficients
? on time invariant variables.
Regress ; if[year = 7] ; lhs=ai;rhs=FixedX;wts=wt$
Regress ; if[year = 7] ; lhs=ai;rhs=FixedX;Het $
Part 4: Fixed Effects [ 69/74]

First Stage Fixed Effects Model


Part 4: Fixed Effects [ 70/74]

Second Stage Regressions

Weighted Least Squares OLS with White Estimator


Part 4: Fixed Effects [ 71/74]

Application
Federal Reserve Board, Division of Research &
Statistics and Monetary Affairs, 2004, rev.
1/2005

Passmore, W., S. Sherlund, and G. Burgess. “The


Effect of Housing Government Sponsored
Enterprises on Mortgage Rates,” Real Estate
Economics, 33, 3, 2005, pp. 427–463.
Part 4: Fixed Effects [ 72/74]

First Stage – Rate Difference


MortgageRatei,t  0 +" loan to value ratio terms"
+ "new home" (dummy variable)
+ "small loan" (dummy variable)
+ "up front fees paid" (dummy variable)
+ "mortgage bank" vs. depository inst. (dummy variable)
+ α1,iJumboLoani,t( dummy variable for loan > $317, 000)
+ i,t
" i"= state,year grouping
"t"= individual loan in specified state,year
Nearly all "conforming" loans (under $317,000) are held by Fannie Mae.
Expect 1,i to be > 0 as Fannie Mae is able to finance at lower cost than
other institutions, and Fannie Mae does not finance Jumbo loans. Interest
is in "pass through" of the cost advantage.
Part 4: Fixed Effects [ 73/74]

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.

MiJ  I  Ji (Ji Ji )Ji


MiJ y i  y i  Ji * mean of those with jumbo loans
 y it  y i,jumbo if jumbo loan
y it   
 y it if not a jumbo loan 
Otherwise, this could be treated like a fixed effects model.
Part 4: Fixed Effects [ 74/74]

Second Stage – Pass Through


a1,i = 0 + 1 "Estimated Capital Cost Advantage"
+ "market characteristics"
+ "state" and "quarter" dummy variables
+ wi

Primary interest is in 1 which is the amount of the


capital cost advantage that is passed through to
mortgagees.

Result: Less than half of cost advantage was passed


through to borrowers.
Part 4: Fixed Effects [ 75/74]

Appendix I. Fixed Effects Vector


Decomposition
Efficient Estimation of Time
Invariant and Rarely Changing
Variables in Finite Sample Panel
Analyses with Unit Fixed Effects

Thomas Plümper and Vera Troeger


Political Analysis, 2007
Part 4: Fixed Effects [ 77/74]

A magic act proceeds in


three steps:
The Pledge
The Turn
The Prestige
Part 4: Fixed Effects [ 78/74]

Introduction: The Pledge


[T]he FE model … does not allow the estimation of
time invariant variables. A second drawback of
the FE model … results from its inefficiency in
estimating the effect of variables that have very
little within variance.
This article discusses a remedy to the related
problems of estimating time invariant and rarely
changing variables in FE models with unit
effects
Part 4: Fixed Effects [ 79/74]

The Model

yit = αi + k=1βk x kit + m=1  m zmi + εit


K M

where αi denote the N unit effects.


Part 4: Fixed Effects [ 80/74]

Fixed Effects Vector Decomposition

Step 1: Compute the fixed effects regression to


get the “estimated unit effects.” “We run this
FE model with the sole intention to obtain
estimates of the unit effects, αi.”

ˆαi = yi - K bFE xki


k=1 k
Part 4: Fixed Effects [ 81/74]

Step 2

Regress ai on zi and compute residuals


ai = m=1  m zim +hi
M

hi is orthogonal to zi (since it is a residual)


Vector hi is expanded so each element
hi is replicated Ti times - h is the length of
the full sample.
Part 4: Fixed Effects [ 82/74]

Step 3
Regress yit on a constant, X, Z and h using
ordinary least squares to estimate α, β, γ, δ.

yit = α + k=1βk x kit + m=1  m zmi + δhi + εit


K M

Notice that i in the original model has


become +h i in the revised model.
Part 4: Fixed Effects [ 83/74]

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]

Step 1 (Based on full sample)


These 2 variables have no within group variation.
FEM ED
F.E. estimates are based on a generalized inverse.
--------+---------------------------------------------------------
| Standard Prob. Mean
LWAGE| Coefficient Error z z>|Z| of X
--------+---------------------------------------------------------
EXP| .09663*** .00119 81.13 .0000 19.8538
WKS| .00114* .00060 1.88 .0600 46.8115
OCC| -.02496* .01390 -1.80 .0724 .51116
IND| .02042 .01558 1.31 .1899 .39544
SOUTH| -.00091 .03457 -.03 .9791 .29028
SMSA| -.04581** .01955 -2.34 .0191 .65378
UNION| .03411** .01505 2.27 .0234 .36399
FEM| .000 .....(Fixed Parameter)..... .11261
ED| .000 .....(Fixed Parameter)..... 12.8454
--------+---------------------------------------------------------
Part 4: Fixed Effects [ 85/74]

Step 2 (Based on 595 observations)

--------+---------------------------------------------------------
| 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]

What happened here?


yit = αi +  k=1βk xkit +  m=1  m zmi + ε it
K M

where αi denote the N unit effects.


An assumption is added along the way
Cov(αi , Zi ) = 0. This is exactly the number of
orthogonality assumptions needed to
identify . It is not part of the original model.
With this assumption, this is slightly different
from a fixed effects model.
Part 4: Fixed Effects [ 89/74]
Part 4: Fixed Effects [ 90/74]

http://davegiles.blogspot.com/2012/06/fixed-effects-vector-decomposition.html
Part 4: Fixed Effects [ 91/74]

Paul Allison, 2005


Part 4: Fixed Effects [ 92/74]

Appendix II. Fixed Effects Algebra


Part 4: Fixed Effects [ 93/74]

Panel Data Algebra


M1D 0 0 
 2 
0 M 0
MD   D  (The dummy variables are orthogonal)
 
 N
 0 0 MD 
MDi  I Ti  di (didi ) 1 d = I Ti  (1/Ti )did
X MD X = Ni=1 X iMDi X i ,  
X iMDi X i
k,l
T
  t=1
i
(x it,k -x i.,k )(x it,l -x i.,l )

X MD y = Ni=1 X iMDi y i , XM y 


i
i
D i k
i
T
  t=1 (x it,k -x i.,k )(y it -y i. )
1
bLSDV  X MD X  X MD y
Part 4: Fixed Effects [ 94/74]

Balanced Panel Data Algebra


MD,T 0 0 
 
 0 MD,T 0 
MD    (Each matrix is T  T)
 
 0 0 MD,T 

MD,T  I T  d(dd ) 1 d = I T  (1/T)dd
1  MD,T 0  MD,T 0  MD,T 
 
0  MD,T 1  MD,T 0  MD,T 
MD     IN  MD,T
 
0  MD,T 0  MD,T 1  MD,T 

Note : dd = a matrix of ones is Baltagi's J T ;
(1/T)dd = a matrix of 1/T is his JT
Part 4: Fixed Effects [ 95/74]

Balanced Panel

MD,T  I T  d(dd ) 1 d = I T  (1/T)dd = I T  JT


1  JT 0  JT 0  JT 
 
 0  JT 1  JT 0  JT 
P is ; PX creates group means
 
 
0  JT 0  JT 1  JT 
1  JT 0  JT 0  JT   X1   X1 
    
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 
Part 4: Fixed Effects [ 96/74]

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?

Vous aimerez peut-être aussi