Note On Panel Data
Note On Panel Data
India
***
***
***
***
***
USA
***
***
***
***
***
Pakistan
***
***
***
***
***
In the typical panel, there are a large number of cross-sectional units and only a few
periods though the opposite case is also relevant.
Such data set focuses on cross-sectional variation or heterogeneity.
There are other names for panel data such as pooled data and longitudinal data. But
strictly not all pooled data are panel data. It will become complete panel only when
we include individual and/or time effects.
Firm ID
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3
Investment (Y)
***
***
***
***
***
***
***
***
***
***
***
***
***
***
***
Firm ID
1
1
1
2
2
2
2
3
3
3
3
Investment (Y)
***
***
***
***
***
***
***
***
***
***
***
4) Methods of Estimation
One-way
FEM
Two-way
FEM
One-way
REM
Two-way
REM
time
dimensions
are
called
unobserved
Thus, model (1) is the usual OLS regression and in panel data context is called pooled
regression model.
Due to omission of group and time dimensions (specification error), the OLS results
might not be fully reliable.
Hence, we need to find some way to take into account group and time dimension in
model (1).
How to accomplish this?
(2)
In (2) we have an intercept term (1i) specific to each individual cross-sectional unit i
Technically, 1i is called the individual effect and is an unknown parameter to be
estimated
Note that in model (1) we have a common intercept term ( 1) which is assumed as
same across all cross-sectional units
By incorporating group dimensions we acknowledge that there are heterogeneity or
significant differences among cross-sectional units and the difference is captured
through individual specific constant term 1i.
Model (2) is known as the one-way Fixed Effects Model since only individual effect
is present.
The term fixed effects is due to the fact that (a) we consider 1i as a group specific
constant term in regression model; and (b) each cross-sectional units (is) intercept
does not vary over time; that is, it is time invariant.
(3)
No of
observati
ons*
1
2
3
4
5
6
7
8
-----------N
Year
Firm ID
1940
1941
1942
1943
1944
1940
1941
1942
1943
1944
1940
1941
1942
1943
1944
1940
1941
1942
1943
1944
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3
4
4
4
4
4
I
74.4
113
91.9
61.3
56.8
461.2
512
448
499.6
547.5
361.6
472.8
445.6
361.6
288.2
28.57
48.51
43.34
37.02
37.81
F
2132.2
1834.1
1588
1749.4
1687.2
4643.9
4551.2
3244.1
4053.7
4379.3
2202.9
2380.5
2168.6
1985.1
1813.9
628.5
537.1
561.2
617.2
626.7
C
186.6
220.9
287.8
319.9
321.3
207.2
255.2
303.7
264.1
201.6
254.2
261.4
298.7
301.8
279.1
26.5
36.2
60.8
84.4
91.2
D1
D2
D3
D4
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
Some econometric packages that support fixed effects estimation report only one
intercept (GRETL does this) which can cause confusion.
Typically, the intercept reported is this case is the average of individual-specific
intercepts: (-52.47 + 208.22 + 233.04 -2.96)/4 = 96.45 in the above example
How to decide on the statistical significance of individual/group effects (or individual
dummies)? [OR] How can we choose between OLS regression results and FEM (with
individual effects) results?
We can use the restricted F test for the purpose. We use F test because our aim is to
test joint significance of null hypothesis that 2 = 3 = n = 0 (n-1 restriction,
since one group is chosen as the base group), where n is the number of crosssectional units [or the null hypothesis is that all dummy parameters
except one are zero: 1 = 2 = n-1 = 0]. In vast majority of applications, the
dummy variables will be jointly significant.
For the purpose of the F test, OLS model is considered a restricted model in the
sense that it imposes a common intercept on all the individual cross-sectional units.
The FEM (with individual effects) is considered as an unrestricted model.
The null hypothesis set for the purpose of testing is: Intercept terms are equal for
all i [or] No significant difference across i's
Acceptance of this null means that the efficient estimator is the one obtained from the
model which assumes constant intercept, i.e. OLS.
The F ratio used for the test is as follows:
(R2UR R2R)/(n-1)
F(n-1, nT-n-K) = --------------------------(1- R2UR)/(nT-n-K)
Where n number of cross sectional units (or groups)
T number of time period w.r.t a single i
K number of explanatory variables (excluding constant)
R2UR R2 value of unrestricted regression model (FEM)
R2R - R2 value of restricted regression model (OLS)
If computed F value (for n-1 numerator df and nT-n-K denominator df) is larger than
the critical value from the F table (for n-1 numerator df and nT-n-K denominator df)
we reject the null hypothesis.
Rejection of null hypothesis favours existence of individual effect in the data (and
vice versa).
If we incorporate this effect, the panel regression model will look like:
Yit = 1t + 2X2it + 3 X3it + uit
(4)
In (4) we have an intercept term (1t) specific to each time period t
Technically, 1t is called the time effect and is an unknown parameter to be estimated
Model (4) is also known as one-way FEM since only time effect is present
We could account for time effects in the model by introducing time dummies (t-1
dummies to avoid perfect collinearity) on the right hand side of the equation (4).
In such case we write (4) as:
Yit= 0+ 1DYear1+ 2DYear2+..+ n DYearT + 2X2it + 3 X3it + uit
(5)
Where DYear1 indicates dummy for year 1; DYear2 indicates dummy for year 2 and
so on. DYear1 takes a value of 1 for observation in Year 1 and 0 otherwise etc.
Assignment of time dummies: Illustration for our example
Year
1940
1941
1942
1943
1944
1940
1941
1942
1943
1944
1940
1941
1942
1943
1944
1940
1941
1942
1943
1944
Firm ID
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3
4
4
4
4
4
I
74.4
113
91.9
61.3
56.8
461.2
512
448
499.6
547.5
361.6
472.8
445.6
361.6
288.2
28.57
48.51
43.34
37.02
37.81
F
2132.2
1834.1
1588
1749.4
1687.2
4643.9
4551.2
3244.1
4053.7
4379.3
2202.9
2380.5
2168.6
1985.1
1813.9
628.5
537.1
561.2
617.2
626.7
C
186.6
220.9
287.8
319.9
321.3
207.2
255.2
303.7
264.1
201.6
254.2
261.4
298.7
301.8
279.1
26.5
36.2
60.8
84.4
91.2
T1
T2
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
T4
T3
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
T5
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
There is no dummy for first time-period, which means 0 represents intercept for first
(or omitted time period in terms of assigning dummies) time-period.
Other s represent differential intercept coefficients indicating how much intercepts
of dummy variable assigned t's differ from intercept of t which is not assigned a
dummy.
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
The problem with time dummies is that it produces many explanatory variables,
especially when the number of time periods is plenty. Also, loss in degrees of
freedom is the major casualty of this exercise.
How to decide on the statistical significance of time effects (or time dummies)? [OR]
How can we choose between OLS regression results and FEM (with time effects)
results?
We can use the restricted F test explained above.
To see what this method involves, consider the following model with a single
explanatory variable: for each i.
yit = 1xit + ai + uit, t = 1, 2, ., T ------ (1)
where ai is the individual or unobserved effect
Now for each i, by averaging equation (1) over time. We get
y i 1 x i ai u i
( 2)
1
Where y i T y it . Similar interpretation holds for x i and u i .
t 1
(or)
y it 1 xit uit , t 1,2,....T ,
Where yit
variables.
y it y i is
(3)
(4)
Note that OLS on (3) should not have a constant term (Why?). Even if we generate a
constant it is arbitrary.
Illustration: elimination of unobserved (individual) effects via fixed effects
transformation
Time
1
2
3
Firm
1
1
1
4
5
1
1
Group
average
2
Actual Data
C
D1
186.6
1
220.9
1
287.8
1
I
74.4
113
91.9
F
2132.2
1834.1
1588
61.3
56.8
397
79.5
1749.4
1687.2
8990.9
1798.18
319.9
321.3
1336.5
267.3
461
4643.9
207.2
Time-demeaned data
I
F
C
-5.08 334.02
-80.7
33.52
35.92
-46.4
12.42 -210.2
20.5
D2
0
0
0
D3
0
0
0
D4
0
0
0
1
1
5
1
0
0
0
0
0
0
-18.18
-22.68
-48.78
-111
52.6
54
-32.46
469.46
-39.16
2
3
4
5
2
2
2
2
1
2
3
4
5
Group
average
3
3
3
3
3
1
2
3
4
5
Group
average
4
4
4
4
4
Group
average
512
448
500
548
2468
494
4551.2
3244.1
4053.7
4379.3
20872.2
4174.44
255.2
303.7
264.1
201.6
1231.8
246.36
0
0
0
0
1
1
1
1
5
1
0
0
0
0
0
0
0
0
18.34
-45.66
5.94
53.84
376.76
-930.3
-120.7
204.86
8.84
57.34
17.74
-44.76
362
473
446
362
288
1930
386
2202.9
2380.5
2168.6
1985.1
1813.9
10551
2110.2
254.2
261.4
298.7
301.8
279.1
1395.2
279.04
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
5
1
0
0
0
0
0
-24.36
86.84
59.64
-24.36
-97.76
92.7
270.3
58.4
-125.1
-296.3
-24.84
-17.64
19.66
22.76
0.06
28.6
48.5
43.3
37
37.8
195
39.1
628.5
537.1
561.2
617.2
626.7
2970.7
594.14
26.5
36.2
60.8
84.4
91.2
299.1
59.82
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
5
1
-10.48
9.46
4.29
-2.03
-1.24
34.36
-57.04
-32.94
23.06
32.56
-33.32
-23.62
0.98
24.58
31.38
The regression on these time-demeaned variables will produce the following result:
Iit = 0.0651 F + 0.0558 C
Now, using the coefficient estimates of F and C, we can compute group dummies by
applying (4) above. For example the dummy for firm one is computed as
= 79.5 [0.0651 (1798.18) + 0.0558 (267.3)]
= 79.5 [117.062 + 14.915]
= -52.477
The fixed effects transformation is also called the within transformation. This can be
done in a single command in STATA econometrics software package.
Since the within transformation or within effect model does not use the
dummies, it has larger degrees of freedom, smaller MSE (mean
square error), and incorrect (smaller) standard errors of
parameters than those of LSDV. Also, R-squared of the within effect
model (which is small compared to LSDV model) is not correct
because an intercept is suppressed.
A pooled OLS estimator that is based on the time-demeaned variable is called the
fixed effects estimator or the within estimator. The latter name comes from the fact
that OLS on (3) uses the time variation in y and x within each cross-sectional
observation.
The method of time-demeaned data can be extended to time-period dummies as
well. In the presence of time effect, the within effect model involves 3 steps: (i)
compute time average of all variables (i.e. take average of variables across time
instead of group-wise); (ii) compute deviation of time-wise observations from the
time average and (iii) use (ii) for running OLS.
Illustration for the above data
Time
Firm
1
1
1
2
1
3
1
4
Average for year 1
I
74.4
461
362
28.6
***
F
2132.2
4643.9
2202.9
628.5
***
C
186.6
207.2
254.2
26.5
***
The major defect of this procedure is that in the process of eliminating the
individual effects, any other explanatory variable that is constant over time for
all i gets swept away.
Hence, we cannot include (i.e. find estimates of) variables such as gender or a citys
distance from a river as explanatory variables in the model. In such a case, we should
use random effects model.
There is yet another way to estimate fixed effects model, called
between group effect model. This model uses aggregate
information, group means of variables (i.e. equation 2 above). In
other words, the unit of analysis is not an individual observation, but
groups or subjects. The number of observations jumps down to n
from nT.
Illustration for the above data:
Firm
Group 1 average
Group 2 average
Group 3 average
Group 4 average
I
79.5
494
386
39.1
F
1798.18
4174.44
2110.2
594.14
C
267.3
246.36
279.04
59.82
Note that between effect model is not valid in case of two-way fixed
effect model (why?)
6.2. Illustration
Let us consider the following one-way (individual effect) FEM
Yit = 1i + 2X2it + 3 X3it + uit
..
(1)
Suppose in this case the sampled cross-sectional units were drawn from a large
population (say the case of longitudinal data set) [OR] the cross-sectional units
included in our sample are a drawing from a much larger universe of such units.
In such cases we need to treat 1i as random variable like uit and not as an
individual specific fixed constant over time.
If we treat 1i as random variable the variable would take the following form
1i = 1 + i i = 1, 2, 3,.., N ---------------- (2)
Where 1 is the mean of intercepts (1i) of all cross-sectional units and i is a random
error term characterizing the ith observation and is constant through time. What the
term (2) essentially implies is that the intercept of an individual cross-sectional unit is
nothing but the mean of intercepts of all cross-sectional units PLUS or MINUS the
error term (the error term represents the random deviation of individual intercept from
the mean of intercepts of all cross-sectional units). Hence, the individual differences
in the intercept value of each company are reflected in the error term i.
Now, Substituting (2) into (1), we obtain:
Yit = 1 + 2X2it + 3 X3it + i + uit
Yit = 1 + 2X2it + 3 X3it + wit
..
(3)
Since the composite error term consists of two or more (if we include time effects)
error terms, REM is also called error components model.
Notice carefully the difference between FEM and REM. In FEM each cross-sectional
unit has its own (fixed) intercept value. In REM, on the other hand, the intercept 1
represents the mean value of all the cross-sectional intercepts, and the error
component i represents the random deviation of individual intercept from this mean
value.
Now, since i is in the composite error in each time period, the wit are serially
correlated across time
That is, correlation (wit, wis) = 2 / ( 2 + 2u), t s. Here, 2 = Variance ( i) and 2u
= Variance (uit).
This serial correlation problem can be solved or eliminated by making use of the
GLS method. As the usual pooled OLS standard errors ignore this correlation, they
will not be correct
Deriving the GLS transformation that eliminates serial correlation in the errors
requires sophisticated matrix algebra. But the transformation itself is simple (or) there
is a simple transformation method.
Now, define 1
u2
( u2 T 2 )
Here lies between zero and one. Then, the transformed equation turns out to be
y it y i 1 (1 ) 2 ( x 2 it x 2 i ) 3 ( x3it x 3i ) ( wit w i )
(3)
This is one major advantage random effects model has over fixed effects model.
Equation (3) allows us to relate the RE estimator to both pooled OLS and fixed
effects.
Pooled OLS is obtained when =0, and FE is obtained when =1.
In practice, the estimate is never zero or one. But, if is close to zero, the RE
estimates will be close to the pooled OLS estimates. This is the case when
unobserved effect i is relatively unimportant (because, it has small variance relative
to 2u).
It is more common for 2 to be large relative to 2u in which case will be closer to
unity.
As T gets large, tends to one, and this makes the RE and FE estimates very similar.
Thus the value of the estimated transformation parameter indicates whether the
estimates are likely to be closer to the pooled OLS or the fixed effects estimates.
The REM with time effect and the REM with both individual and time effects is a
straightforward extension of the REM with individual effect.
The REM with time effect will take the following form:
Yit = 1 + 2X2it + 3 X3it + t + uit
Yit = 1 + 2X2it + 3 X3it + vit
where vit = t + uit
The REM with both individual and time effect will take the following form:
Yit = 1 + 2X2it + 3 X3it + i + t + uit
Yit = 1 + 2X2it + 3 X3it + Wit
where Wit = i + t + uit
In correlation (wit, wis) = 2 / ( 2 + 2u), t s, if 2 = 0 then correlation (wit, wis) will become zero.
Consider an example. Suppose we have a random sample of large number of individuals and we want
to model their wage or earnings function. Suppose earnings are a function of education, work
experience, etc. Now if we let i stand for innate ability, family background etc., then when we model
the earnings function including i it is very likely to be correlated with education, for innate ability and
family background are often crucial determinants of education. As Wooldridge contends, In many
applications, the whole reason for using panel data is to allow the unobserved effect [i.e., i] to be
correlated with the explanatory variables.