Download presentation
Presentation is loading. Please wait.
1
Esman M. Nyamongo Central Bank of Kenya
Panel data analysis Econometrics Course organized by the COMESA Monetary Institute (CMI) on 9-13 February 2015, Kampala, Uganda Esman M. Nyamongo Central Bank of Kenya
2
panel Data- where we are coming from
There are 3 types of data Cross sectional data Time series data Panel data The cross-section and time series are the primary building blocks of Panel
3
Time series data A time series is a set of observations on the values that a variable takes at different times Such data may be collected at regular time intervals Minutely and Hourly- collected literally continuously ( the so-called real time quote) Daily- e.g., Financial time series-Stock prices, exchange rates; weather reports- rainfall, temperature Weekly – e.g., money supply Monthly- e.g., consumer price index Quarterly- e.g., GDP Semi-annually- e.g., Fiscal data Annually- e.g., Fiscal data Quinquennially ( every 5 years)- e.g., manufacturing survey Decennially- (every 10 years)- e.g., population census data
4
Illustration of time series
5
Consumption and Income (annual)
The model setup: Where t= time series
6
Cross-sectional data Cross-section data is data on one or more variables collected at a particular point in time in time Survey data- questionnaire is designed to capture all variables a research is looking for. Macro data relating to different economic entities : countries, banks at a particular point in time. E.g Other data
7
Summary data from income survey
8
Cross-country data The model set up Where i= cross -section
9
Panel data Panel data is a combination of both time and cross-section data Specialized type is the longitudinal or micropanel data where a cross-sectional unit (say, individual, family, firm) is surveyed over time. Surveying same individual over time is able to provide useful information on the dynamics of individual/household/firm behavior
10
Example
11
Pooled data
12
Some Advantages of panel data
Controlling for individual heterogeneity. Panel data suggests that individuals, firms, states or countries are heterogeneous. Panel data give more informative data, more variability, less collinearity among the variables, more degrees of freedom and more efficiency Panel data are better able to study the dynamics of adjustment. Panel data are better able to identify and measure effects that are simply not detectable in pure cross- section or pure time-series data. Consider a country where labor participation rate is 50%! it is possible each individual has 50% chance of participation 50% of individuals work 100% of the time and the other 50% work 0% of the time yielding 50% participation.
13
Panel data model set up Time series + cross-section
Where i= cross section; t= time series How then do we estimate this model? Many approaches
14
Part i
15
a. pooled estimator Emphasizes the joint estimation of coefficients- ignores panel structure of the data where y= dependent variable, Xs= regressors for all i and t. i.e For a given cross section, observations are serially uncorrelated Across cross-sections and time, the errors are homoscedastic
16
But how realistic is it to ignore the panel structure of the data?
These assumptions- classical assumptions therefore suggest we estimate the equation by OLS Pooling- increases degrees of freedom, potentially lowering standard errors on the coefficients. This involves stacking cross-sections in the data set This form assumes same intercept and same slope for all coefficients But how realistic is it to ignore the panel structure of the data?
17
Short practical session
Preparation of data for use in panel estimation Estimation of pooled model using Eviews
18
Pooled regression results
Same slope and intercept is assumed Homogeneity of the cross-section units
19
b. Error component model
20
B. The error-components model
Recall In this model u may display 3 different schemes: (i) consists of 3 individual shocks, each assumed to be independent of each other: is cross section invariant shock- time effect is time invariant shock- individual effect is the error term with usual properties- uncorrelated with Xit
21
Scheme (i) is the TWO-WAY-ERROR COMPONENT MODEL
(ii) to yield: Cross-section fixed effects model (iii) to yield: Time-fixed effects model. Schemes (ii) and (iii) are referred to as ONE-AWAY ERROR COMPONENT MODEL Scheme (i) is the TWO-WAY-ERROR COMPONENT MODEL
22
i. One way error component models
Follows from the restrictions imposed by the pooled model i.e joint intercept and slope for i=1,2….N for t=1,2….T One-way error component model allows cross-section heterogeneity in the error term. Error term (uit) becomes the sum of an individual specific effect ( vi- time invariant) and a ‘well behaved’ disturbance ( )
23
In this formulation we have:
The first part varies over cross-section units but is constant across time The second part varies unsystematically (independently) across time and individuals
24
Estimation method Two ways to estimate a regression model with error terms that are assumed to consist of several error components: Fixed-effects- (1) the constant/intercept in each equation is a separate parameter (2) values of vi are potentially correlated with the other regressors Random-effects – (1) differences in the vi are randomly distributed between units (2) values of vi are uncorrelated with the other regressors
25
1. Fixed effects model Recall: Fixed-effects model-
(1) each equation constant is a separate parameter (2) values of vi are potentially correlated with the other regressors
26
The main question is whether Xit is correlated with uit:
If no, then we have a seemingly unrelated regression If yes, then we have a multi-equation system with common coefficients and endogenous regressors Then how do we account for this endogeneity- In time series we use instrumental variable estimation methods (2sls,3sls etc) However, in panel we can handle this, under certain assumptions, without using instruments How?
27
Some approaches There are 3 approaches to doing this in panel:
The least squares dummy variables (LSDV) estimator The within-group estimator The first difference estimator Discussed in turns
28
1. Least Squares Dummy Variables (LSDV)
LSDV method applies OLS to levels with group specific dummies added to the list of regressors. Explains why the estimator is called the Least- Squares Dummy Variables (LSDV) estimator Consider the general model: Stack the observations over t, to obtain:
29
The pooled regression is then:
Where is a Kronecker product Since 1T is a regressor alongside Xit then we expect:
30
Too many parameters (especially with large N!
This model is appealing , but consider the number of parameters to be estimated! K+1+(N-1)= k+N K= parameters for the original X-regressors 1= parameter for the intercept N-1= parameters for cross-section fixed effects (omitted x-section captured by intercept) Too many parameters (especially with large N! N-1 K+1
31
There are many parameters (Bs and Ds) being estimated.
But can be estimated using OLS following the Frisch-Waugh-Lovell (FWL) theorem on partitioned regressions: Digression on FWL and partitioned regressions
32
Based on this result it can be shown that the fixed effects estimator is the partitioned OLS estimator of in pooled regression. Where It then follows that: Therefore:
33
Whence it follows that:
This is basically a pooled OLS estimator on transformed data
34
Least Squares Dummy Variable est.
35
2. Within, Q, Estimation Still assumes individual effects although we no longer directly estimate them. We demean the data- wipe out the individual effects- to estimate only B How do we wipe out the individual effects? We define a Q matrix . Where Q is defined such that: where
36
Consider a simple regression:
The trick is to remove the fixed effects, vi. How? Step 1: Average over time t for each i.
37
Step 2: The transformed regression:
Then, stack by observation for t= 1, …., T, resulting in:
38
Degrees of freedom of FE estimator
The within-group fixed-effects estimator is pooled OLS on the transformed regression that has been stacked by observations: Degrees of freedom of FE estimator nT-k-n=n(T-1)-k Why- lose 1 degree of freedom in each fixed effect estimated. There are k Bs to be estimated as well
39
General case: Stack an individual i’s observations for t=1,…..,T, giving: Or i= 1 , 2, …., n Where 1T is a (Tx1) vector of ones
40
The fixed-effects estimator is applied to a T- equation system transformed from the original system above. The matrix used for the transformation is the so-called annihilator associated with 1T: where Q is a T x T matrix:
41
The matrices QT and PT are such that:
What does this mean- the QT and PT matrices takes you back to the transformed y
42
The transformed error-components model is then:
The pooled regression is stated as: sss
43
The fixed-effects estimator is again obtained by pooled OLS on the transformed system:
Why? QT is idempotent i.e QTQT=QT In other words:
44
is an NTx1 vector with ‘stacked’ deviations
P is the matrix that averages across time for each individual cross section. Thus pre-multiplying this regression by Q obtains deviations from means WITHIN each cross- section is an NTx1 vector with ‘stacked’ deviations The OLS estimator is therefore: Demeaning the data will not change the estimates for . Similar to running a regression with the line of best fit passing through the origin
45
Thus the ‘WITHIN’ model becomes a simple regression:
Individual effects can be solved ( not estimated). But we need the following assumption: And solving:
46
Fixed Effects: Within estimation
Notice the fixed effects are not estimated. Computed instead.
47
Within- For clickers The computed FE are indicated.
But what are these FE?
48
Disadvantages of the method
Demeaning the data means X-regressors which are themselves dummy variables cannot be used (sex, religion, etc)
49
Which one do we work with?- Pooled or FE
Both coefficients are positive and significant. Therefore satisfy some theory! Which one do we choose?
50
Testing the joint validity of fixed effects
The null hypothesis Alternative HA: Not all equal to 0 We test the null hypothesis of no individual effects within applied Chow or F-test, combining the residual sum of squares for the regression both with constraints (under the null) and without (under alternative). The recipe: RSS- OLS on pooled model ( constant intercept) URSS- OLS on LSDV
51
The F- statistics is stated as:
If N is ‘large enough’ can use ‘WITHIN’ estimation instead of LSDV for the RSS. The decision rule: P-value < 0.05 we reject the null hypothesis => FE are not redundant P-value> 0.05, we fail to reject the null hypothesis => FE are redundant, suggesting pooled model is valid
52
Part ii
53
Ii Two way error component model
Recall: i=1,….,N; t=1, …..,T Where = unobservable individual effect; =unobservable time effect; stochastic disturbance = selector matrix of ones and zeros- individual effects = time dummies
54
1. Estimating fixed effects
Here we still assume and are fixed parameters to be estimated and Estimation with LSDV requires the estimation of {(N-1)+(T-1)} dummies This can introduce rather severe loss of degrees of freedom once again to avoid this problem we perform ‘ WITHIN’ transformation (similar to one-way model). Now, however, we must demean across both dimensions
55
Here we work with the following:
Where:JN= matrix of ones of dimension N deviations across i deviations across t Transforming with Q sweeps out the time and individual effects
56
Here we have a simple regression (one-x regressor):
We now need 2 constraints to capture individual and time effects Then we can compute the intercepts using Again as in one way model we cannot use time-invariant or individual-invariant (dummy regressors) as Q wipes them out.
57
Two way fixed effects ESTIMATION RESULTS
58
For clickers How do we interpret these result
59
Practical session
60
Supplementary information
61
Panel data set
62
Longitudinal/Micropanel data
63
Pooled regression Same results
64
1 Kronecker product
65
LSDV- For clickers
66
2. Fwl and partitioned regressions
Consider the partitioned regression equation: Where K=k1+k2 The least-squares estimators for B1 and B2 can be expressed as: Where
67
3. Annihilator matrix The residual maker and the Hat Matrix
Some useful matrices: We know Meaning: Where is called the residual maker since it makes residuals out of y. Matrix M is idempotent if [M2=MM=M]
68
M is a square matrix and idempotent- show
The matrix has the following properties as well: The hat matrix (H)- makes y hat out of y. where
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.