Panel Data
Analysis
Lecture 2
Introduction
Spring 2025
TS109- WEEK 2
Mohamed Abdallah
Lecturer of Applied
Statistics&Economerics
[email protected]
01222596520
Econometric Analysis of Panel Data
4. Fixed Effects
Estimation with Fixed Effects
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 , c2 ,...cN ), Ni=1 Ti by 1 vector
ci is arbitrarily correlated with xit but E[εit|Xi,ci]=0
Dummy variable representation
y it =xitβ+Nj=1 jdijt +εit , dijt = 1(i=j)
Assumptions for the FE 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.
Common: Cov[xit,ci] ≠0
Useful Analysis of Variance Notation
Decomposition of Total variation:
2
N
Σ Σ Ti 2
(zit z) Σ N
Σ Ti
(zit zi.) Σ
2 N
Ti zi. z
i=1 t=1 i=1 t=1 i=1
Total variation = Within groups variation
+ Between groups variation
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.
Analysis of Variance
Per Capita Gasoline Use for 18 OECD Countries
6 .5 0
6 .0 0
5 .5 0
5 .0 0
LGASPCAR
4 .5 0
4 .0 0
3 .5 0
3 .0 0
0 2 4 6 8 10 12 14 16 18
COUNT RY
Analysis of Variance
+--------------------------------------------------------------------------+
| Analysis of Variance for LGASPCAR |
| Stratification Variable COUNTRY |
| Observations weighted by ONE |
| Total Sample Size 342 |
| Number of Groups 18 |
| Number of groups with no data 0 |
| Overall Sample Mean 4.2962420 |
| Sample Standard Deviation .5489071 |
| Total Sample Variance .3012990 |
| |
| Source of Variation Variation Deg.Fr. Mean Square |
| Between Groups 85.68228007 17 5.04013 |
| Within Groups 17.06068428 324 .05266 |
| Total 102.74296435 341 .30130 |
| Residual S.D. .22946990 |
| R-squared .83394791 MSB/MSW 21.96425 |
| F ratio 95.71734806 P value .00000 |
+--------------------------------------------------------------------------+
REGRESS;Lhs=lgaspcar ; Rhs=one ; Panel ; Str = Country $
Estimating the Fixed Effects Model
The FEM is a plain vanilla regression model but
with many independent variables
Least squares is unbiased, consistent, efficient,
but inconvenient if N is large.
1
b X X X D X y
Dy
a
D X D D
Using the Frisch-Waugh theorem
b =[X MD X ]1 X MD y
Fixed Effects Estimator (cont.)
M1D 0 0
2
0 MD 0
MD (The dummy variables are orthogonal)
N
0 0 MD
MDi I Ti di (didi )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 , XM y
i
i
D i k
i
T
t=1 (x it,k -x i.,k )(y it -y i. )
The Within Transformation
Removes the Effects
y it x itβ c i +εit
y i x iβ c i +εi
y it y i ( x it - x i )β (εit εi )
y it x itβ εit
Classical assumptions apply to the transformed model
Wooldridge notation for data in deviations from group means
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 -xitb)=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.
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.
Asy.Var[b] =(2 / Ni=1 Ti )plim[(2 / Ni=1 Ti )Ni=1 XiMDi X i ]1
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)
Application Cornwell and Rupert
LSDV Results
Note huge changes in
the coefficients. SMSA
and MS change signs.
Significance changes
completely!
The Effect of the Effects
On Computation
“Sometimes it is useful to obtain the cˆi even when the
(dummy variable) regression is infeasible.” (W: p.
273) It is never infeasible.
The degrees of freedom correction must include the
constants (N of them).
The Estimated Fixed Effects
Fixed E ffects fr om C or nwell 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
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.
Robust Counterpart to White Estimator?
Var[εi] = Ωi ≠2ITi
ei = yi – aiiTi - Xib = MDyi – MDXib
(group mean deviations)
Est.Asy.Var[b]=
1 1
XiM X i (XiM )eiei (M X i ) XiM X i
N
i=1
i
D
N
i=1
i
D
i
D
N
i=1
i
D
Resembles (and is based on) White, but treats a
full vector of disturbances at a time. Robust to
heteroscedasticity and autocorrelation (within
the groups).
Robust Covariance Matrix for LSDV
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
|OCC | -.02021 .01374007 -1.471 .1412 .5111645|
|SMSA | -.04251** .01950085 -2.180 .0293 .6537815|
|MS | -.02946 .01913652 -1.540 .1236 .8144058|
|EXP | .09666*** .00119162 81.114 .0000 19.853782|
+--------+------------------------------------------------------------+
+---------------------------------------------------------------------+
| Covariance matrix for the model is adjusted for data clustering. |
| Sample of 4165 observations contained 595 clusters defined by |
| 7 observations (fixed number) in each cluster. |
+---------------------------------------------------------------------+
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
|DOCC | -.02021 .01982162 -1.020 .3078 .41583D-17|
|DSMSA | -.04251 .03091685 -1.375 .1692 .10396D-17|
|DMS | -.02946 .02635035 -1.118 .2635 .15994D-17|
|DEXP | .09666*** .00176599 54.732 .0000 .00000|
+--------+------------------------------------------------------------+
How To
create;dlwage=groupdevs(lwage,pds=7)$
create;docc=groupdevs(occ,pds=7)$
create;dsmsa=groupdevs(smsa,pds=7)$
create;dms=groupdevs(ms,pds=7)$
create;dexp=groupdevs(exp,pds=7)$
regress;lhs=dlwage;rhs=docc,dsmsa,dms,dexp;cluster=7$
regress;lhs=lwage;rhs=occ,smsa,ms,exp;panel;pds=7$
Asymptotics for ai
ai (didi ) 1 di ( 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)
2
(See slide 13, limN N
=0)
i1 Ti
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=1eiei from fixed effects
(2) Unbalanced case? Put zeros in ei in appropriate places?
Elements of Ωˆ are now based on different T. i
ˆ is TxT with rank at most N. If T > N, Ω
Note Ω ˆ is
singular and GLS cannot be computed. N will be >> T.
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
ˆ i1 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 2 (Ni1 Ti ) N K 2 1 K 2 1 N K
ˆ
N 1 N 1 N
T
i1 i T T
i1 T
ML Estimation (cont.)
2 2 (Ni1 Ti ) N K 2 1 K 2 1 N K
ˆ 1 1
T N
Ni1 Ti T Ni1 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 an example of the Incidental Parameters
Problem. (Neyman and Scott (1948). It occurs because the
number of parameters being estimated is growing as N grows.
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: y it y it y i . 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
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
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
Marginal changes in the estimates. Why?
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 |
+--------------------------------------------------------------------+
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
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.
FE With Time Invariant Variables
+----------------------------------------------------+
| There are 3 vars. with no within group variation. |
| FEM ED BLK |
| 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|
+--------+--------------+----------------+--------+--------+----------+
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 | .13543670 ......(Fixed Parameter).......
BLK | .000000 ......(Fixed Parameter).......
+--------------------------------------------------------------------+
| Model Log-Likelihood Sum of Squares R-squared |
|(1) Constant term only -2688.80597 .8869049390D+03 .0000000 |
|(2) Group effects only 27.58464 .2406511943D+03 .7286618 |
|(3) X - variables only -1688.12010 .5485159622D+03 .3815392 |
|(4) X and group effects 2223.20087 .8385013031D+02 .9054576 |
+--------------------------------------------------------------------+
Drop Time Invariant Variables
+--------+--------------+----------------+--------+--------+----------+
|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 .8869049390D+03 .0000000 |
|(2) Group effects only 27.58464 .2406511943D+03 .7286618 |
|(3) X - variables only -2270.00441 .7253342733D+03 .1821736 |
|(4) X and group effects 2223.20087 .8385013031D+02 .9054576 |
+--------------------------------------------------------------------+
No change in the sum of squared residuals
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
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
The Model
(1) yit k 1k xkit m1 m zmi ui it
K M
where ui denote the N-1 unit effects.
In more familiar notation:
(1) yit i k 1k xkit m1 m zmi it
K M
where i denote the N unit effects.
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.
(4) uˆi yi k 1 bkFE xki ei
K
Using group means and group mean residuals.
Math result: ei 0 (by construction). The
rest is
(4) uˆi ˆ i yi k 1 bkFE xki
K
Step 2
Regress ai on zi and compute residuals
ai m1 m zim hi
M
hi is orthogonal to z (since it is a residual)
Step 3
Regress yit on the constants, X, Z and h using
ordinary least squares.
(1) yit i k 1k xkit m1 m zmi it
K M
becomes
(7) yit k 1k xkit m1 m zmi hi it
K M
The Turn:
Based on Cornwell and Rupert
namelist ; x = exp,wks,occ,ind,south,smsa,union
; z = fem,ed,blk $
(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 $
The Turn: Setup Step 1
These 3 variables have no within group variation.
FEM ED BLK
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
BLK| .000 .....(Fixed Parameter)..... .07227
--------+---------------------------------------------------------
The Turn: Setup Step 2
--------+---------------------------------------------------------
| 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
BLK| -.27615*** .05954 -4.64 .0000 .07227
--------+---------------------------------------------------------
The Turn: Setup 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
BLK| -.27615*** .00894 -30.90 .0000 .07227
HI| 1.00000*** .00670 149.26 .0000 -.103D-13
--------+---------------------------------------------------------
The Prestige
Step 1
Step 3
Step 2
Unbalanced Panel Data
t=1 t=2 t=3 t=4
i=1 ● ●
i=2 ● ●
Ti
i=3 ● ● ● ● z.i z
t 1 it
i=4 ● ●
i=5 ● ●
i=6 ● ● ●
Nt
z.t z i1 it
Two Way FE with Unbalanced Data
This computation is not available in two way FE
models with unbalanced panels:
1
b= i1 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)
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
Application: Doctor Visits:
Directly Transformed Data (Gives the wrong answer)
+----------------------------------------------------+
| LHS=DVIS Mean = -.4180543E-15 |
| Residuals Sum of squares = 433269.1 |
+----------------------------------------------------+
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
DINC | -.76897387 .25034420 -3.072 .0021 -.244966D-14
Two way using internal procedure or one way plus time dummy variables
(This is the correct answer.)
+----------------------------------------------------+
| Least Squares with Group and Period Effects |
| Residuals Sum of squares = 433280.7 |
+----------------------------------------------------+
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
HHNINC | -.98324452 .30539381 -3.220 .0013 .35208362
(Software notes: Stata does not contain a two way FE routine, so this must be done by the
user with the time dummies. NLOGIT creates the time dummies in the background.)
Different Normalizations
Separate constants: using D
Overall constant and N-1 constrasts
Overall constant, N constants, ii = 0
y=Xβ+Dα+ε
=Xβ+Cα * +ε
= y, so Cα* = Dα = (DP)(P 1α)
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 1 0 0 0
0 0 i 0 1
1 0 0
0 0 0 i P 1
i 0 0 0 1 0 0 0
1 0 1 0
i
i 0 0 1 1 0 0 1 0 0 1
C D DP
i 0 i 0 1 0 1 0
i 0 0 i 1 0 0 1
-1
P a = α1 ,α2 α1 ,α3 α1 ,...,αN α1
Implication: No change in other coefficients, no change in sum of squares or R2
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$
Crea ; varai=ssqrd/_Groupti + qfr(means,varb) ; wt=1/varai$
? Weighted least squares regression of dummy variable coefficients
? on time invariant variables.
Reject ; year<7$
Regress ; lhs=ai;rhs=FixedX;wts=wt$
Regress ; lhs=ai;rhs=FixedX;Het $
First Stage Fixed Effects Model
Second Stage Regressions
Weighted Least Squares OLS with White Estimator
Mundlak’s Approach
y it x it β+ziδ 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[w i|X i , zi ] 0, Var[w i|X i , zi ] 2w
y it x it β ziδ x i w i εit
= random effects model including group means.
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
Application
Passmore,W. et al., “The Effect of Housing
Government Sponsored Enterprises on
Mortgage Rates,”
Federal Reserve Board, Division of Research &
Statistics and Monetary Affairs, 2004, rev.
1/2005
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,i JumboLoani,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.
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.
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 ( Ji Ji ) Ji
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.
Thank
you