Doc00026

Page 1

Panel Data Linear Models

Fitting Panel Data Linear Models in Stata Gustavo Sanchez Senior Statistician StataCorp LP

Puebla, Mexico

Gustavo Sanchez (StataCorp)

June 22-23, 2012

1 / 42


Panel Data Linear Models Outline

Outline Brief introduction to panel data linear models Fixed and Random effects models

Fitting the model in Stata Specifying the panel structure Regression output

Testing and accounting for serial correlation and heteroskedasticity Panel Unit root tests - Model in first differences Dynamic panel linear models

Gustavo Sanchez (StataCorp)

June 22-23, 2012

2 / 42


Panel Data Linear Models Outline

Outline Brief introduction to panel data linear models Fixed and Random effects models

Fitting the model in Stata Specifying the panel structure Regression output

Testing and accounting for serial correlation and heteroskedasticity Panel Unit root tests - Model in first differences Dynamic panel linear models

Gustavo Sanchez (StataCorp)

June 22-23, 2012

2 / 42


Panel Data Linear Models Outline

Outline Brief introduction to panel data linear models Fixed and Random effects models

Fitting the model in Stata Specifying the panel structure Regression output

Testing and accounting for serial correlation and heteroskedasticity Panel Unit root tests - Model in first differences Dynamic panel linear models

Gustavo Sanchez (StataCorp)

June 22-23, 2012

2 / 42


Panel Data Linear Models Outline

Outline Brief introduction to panel data linear models Fixed and Random effects models

Fitting the model in Stata Specifying the panel structure Regression output

Testing and accounting for serial correlation and heteroskedasticity Panel Unit root tests - Model in first differences Dynamic panel linear models

Gustavo Sanchez (StataCorp)

June 22-23, 2012

2 / 42


Panel Data Linear Models Outline

Outline Brief introduction to panel data linear models Fixed and Random effects models

Fitting the model in Stata Specifying the panel structure Regression output

Testing and accounting for serial correlation and heteroskedasticity Panel Unit root tests - Model in first differences Dynamic panel linear models

Gustavo Sanchez (StataCorp)

June 22-23, 2012

2 / 42


Panel Data Linear Models Introduction to Panel Data Linear Models

Brief Introduction to Panel Data Linear Models

Gustavo Sanchez (StataCorp)

June 22-23, 2012

3 / 42


Panel Data Linear Models Introduction to Panel Data Linear Models One-way error component model

One-way error component model Yit = Îą + Xit1 ∗ β1 + ... + XitK ∗ βK + it Yit = Îą + Xit1 ∗ β1 + ... + XitK ∗ βK + Âľi + νit i = 1, ..., N j = 1, ..., T

Gustavo Sanchez (StataCorp)

June 22-23, 2012

4 / 42


Panel Data Linear Models Introduction to Panel Data Linear Models One-way error component model

One-way error component model Yit = Îą + Xit1 ∗ β1 + ... + XitK ∗ βK + it Yit = Îą + Xit1 ∗ β1 + ... + XitK ∗ βK + Âľi + νit i = 1, ..., N j = 1, ..., T

Gustavo Sanchez (StataCorp)

June 22-23, 2012

4 / 42


Panel Data Linear Models Introduction to Panel Data Linear Models One-way error component model - Fixed effects

Fixed Effects Models Yit = α + Xit1 ∗ β1 + ... + XitK ∗ βK + µi + νit

Some Relevant Assumptions The non-observable individual effects are represented by fixed parameters The explanatory variables in X are independent of the idiosyncratic error term but they are not independent of the individual fixed effects The idiosyncratic error term νit is iid(0, σν2 )

Gustavo Sanchez (StataCorp)

June 22-23, 2012

5 / 42


Panel Data Linear Models Introduction to Panel Data Linear Models One-way error component model - Fixed effects

Fixed Effects Models Yit = α + Xit1 ∗ β1 + ... + XitK ∗ βK + µi + νit

Some Relevant Assumptions The non-observable individual effects are represented by fixed parameters The explanatory variables in X are independent of the idiosyncratic error term but they are not independent of the individual fixed effects The idiosyncratic error term νit is iid(0, σν2 )

Gustavo Sanchez (StataCorp)

June 22-23, 2012

5 / 42


Panel Data Linear Models Introduction to Panel Data Linear Models One-way error component model - Fixed effects

Fixed Effects Models Yit = α + Xit1 ∗ β1 + ... + XitK ∗ βK + µi + νit

Some Relevant Assumptions The non-observable individual effects are represented by fixed parameters The explanatory variables in X are independent of the idiosyncratic error term but they are not independent of the individual fixed effects The idiosyncratic error term νit is iid(0, σν2 )

Gustavo Sanchez (StataCorp)

June 22-23, 2012

5 / 42


Panel Data Linear Models Introduction to Panel Data Linear Models One-way error component model - Fixed effects

Fixed Effects Models Let’s assume that we have only one explanatory variable: Yit = α + Xit ∗ β + µi + νit Let’s take the average in time: Y¯i. = α + X¯i. ∗ β + µi + ν¯i. Let’s take the difference between those two equations: Yit − Y¯i. = (Xit − X¯i. ) ∗ β + (νit − ν¯i. ) This ”within transformation” is the basis for the fixed effects estimator. The FE beta estimates could be obtained by using OLS in the latest equation Gustavo Sanchez (StataCorp)

June 22-23, 2012

6 / 42


Panel Data Linear Models Introduction to Panel Data Linear Models One-way error component model - Fixed effects

Fixed Effects Models Let’s assume that we have only one explanatory variable: Yit = α + Xit ∗ β + µi + νit Let’s take the average in time: Y¯i. = α + X¯i. ∗ β + µi + ν¯i. Let’s take the difference between those two equations: Yit − Y¯i. = (Xit − X¯i. ) ∗ β + (νit − ν¯i. ) This ”within transformation” is the basis for the fixed effects estimator. The FE beta estimates could be obtained by using OLS in the latest equation Gustavo Sanchez (StataCorp)

June 22-23, 2012

6 / 42


Panel Data Linear Models Introduction to Panel Data Linear Models One-way error component model - Fixed effects

Fixed Effects Models Let’s assume that we have only one explanatory variable: Yit = α + Xit ∗ β + µi + νit Let’s take the average in time: Y¯i. = α + X¯i. ∗ β + µi + ν¯i. Let’s take the difference between those two equations: Yit − Y¯i. = (Xit − X¯i. ) ∗ β + (νit − ν¯i. ) This ”within transformation” is the basis for the fixed effects estimator. The FE beta estimates could be obtained by using OLS in the latest equation Gustavo Sanchez (StataCorp)

June 22-23, 2012

6 / 42


Panel Data Linear Models Introduction to Panel Data Linear Models One-way error component model - Fixed effects

Fixed Effects Models Let’s assume that we have only one explanatory variable: Yit = α + Xit ∗ β + µi + νit Let’s take the average in time: Y¯i. = α + X¯i. ∗ β + µi + ν¯i. Let’s take the difference between those two equations: Yit − Y¯i. = (Xit − X¯i. ) ∗ β + (νit − ν¯i. ) This ”within transformation” is the basis for the fixed effects estimator. The FE beta estimates could be obtained by using OLS in the latest equation Gustavo Sanchez (StataCorp)

June 22-23, 2012

6 / 42


Panel Data Linear Models Introduction to Panel Data Linear Models One-way error component model - Fixed effects

Fixed Effects Models Let’s assume that we have only one explanatory variable: Yit = α + Xit ∗ β + µi + νit Let’s take the average in time: Y¯i. = α + X¯i. ∗ β + µi + ν¯i. Let’s take the difference between those two equations: Yit − Y¯i. = (Xit − X¯i. ) ∗ β + (νit − ν¯i. ) This ”within transformation” is the basis for the fixed effects estimator. The FE beta estimates could be obtained by using OLS in the latest equation Gustavo Sanchez (StataCorp)

June 22-23, 2012

6 / 42


Panel Data Linear Models Introduction to Panel Data Linear Models One-way error component model - Random effects

Random Effects Models Yit = α + Xit1 ∗ β1 + ... + XitK ∗ βK + µi + νit

Some Relevant Assumptions The non-observable individual effects are iid(0,σµ2 ) The explanatory variables in X are independent of the idiosyncratic error term and they are also independent of the individual random effects (i.e. Cov(Xkit , µi ) = 0) The idiosyncratic error term νit is iid(0, σν2 )

Gustavo Sanchez (StataCorp)

June 22-23, 2012

7 / 42


Panel Data Linear Models Introduction to Panel Data Linear Models One-way error component model - Random effects

Random Effects Models Yit = α + Xit1 ∗ β1 + ... + XitK ∗ βK + µi + νit

Some Relevant Assumptions The non-observable individual effects are iid(0,σµ2 ) The explanatory variables in X are independent of the idiosyncratic error term and they are also independent of the individual random effects (i.e. Cov(Xkit , µi ) = 0) The idiosyncratic error term νit is iid(0, σν2 )

Gustavo Sanchez (StataCorp)

June 22-23, 2012

7 / 42


Panel Data Linear Models Introduction to Panel Data Linear Models One-way error component model - Random effects

Random Effects Models Yit = α + Xit1 ∗ β1 + ... + XitK ∗ βK + µi + νit

Some Relevant Assumptions The non-observable individual effects are iid(0,σµ2 ) The explanatory variables in X are independent of the idiosyncratic error term and they are also independent of the individual random effects (i.e. Cov(Xkit , µi ) = 0) The idiosyncratic error term νit is iid(0, σν2 )

Gustavo Sanchez (StataCorp)

June 22-23, 2012

7 / 42


Panel Data Linear Models Fitting the model in Stata

Fitting the model in Stata

Gustavo Sanchez (StataCorp)

June 22-23, 2012

8 / 42


Panel Data Linear Models Fitting the model in Stata Empirical example

Model for aggregate consumption consumoit = α + pibit ∗ β1 + pibit−1 ∗ β2 + irateit ∗ β3 + µi + νit Data World Bank public online data on: consumo: Final consumption expenditure (Y2000=100) pib: Gross domestic product (Y2000=100) irate deposit interest rate Example 1: 1980-2010 for 122 countries Example 2: 2003-2010 for 104-108 countries : Source:http://databank.worldbank.org/data/Home.aspx

Gustavo Sanchez (StataCorp)

June 22-23, 2012

9 / 42


Panel Data Linear Models Fitting the model in Stata Empirical example

Model for aggregate consumption consumoit = α + pibit ∗ β1 + pibit−1 ∗ β2 + irateit ∗ β3 + µi + νit Data World Bank public online data on: consumo: Final consumption expenditure (Y2000=100) pib: Gross domestic product (Y2000=100) irate deposit interest rate Example 1: 1980-2010 for 122 countries Example 2: 2003-2010 for 104-108 countries : Source:http://databank.worldbank.org/data/Home.aspx

Gustavo Sanchez (StataCorp)

June 22-23, 2012

9 / 42


Panel Data Linear Models Fitting the model in Stata Empirical example

Model for aggregate consumption consumoit = α + pibit ∗ β1 + pibit−1 ∗ β2 + irateit ∗ β3 + µi + νit Data World Bank public online data on: consumo: Final consumption expenditure (Y2000=100) pib: Gross domestic product (Y2000=100) irate deposit interest rate Example 1: 1980-2010 for 122 countries Example 2: 2003-2010 for 104-108 countries : Source:http://databank.worldbank.org/data/Home.aspx

Gustavo Sanchez (StataCorp)

June 22-23, 2012

9 / 42


Panel Data Linear Models Fitting the model in Stata Empirical example

Model for aggregate consumption consumoit = α + pibit ∗ β1 + pibit−1 ∗ β2 + irateit ∗ β3 + µi + νit Data World Bank public online data on: consumo: Final consumption expenditure (Y2000=100) pib: Gross domestic product (Y2000=100) irate deposit interest rate Example 1: 1980-2010 for 122 countries Example 2: 2003-2010 for 104-108 countries : Source:http://databank.worldbank.org/data/Home.aspx

Gustavo Sanchez (StataCorp)

June 22-23, 2012

9 / 42


Panel Data Linear Models Fitting the model in Stata Empirical example

Model for aggregate consumption consumoit = α + pibit ∗ β1 + pibit−1 ∗ β2 + irateit ∗ β3 + µi + νit Data World Bank public online data on: consumo: Final consumption expenditure (Y2000=100) pib: Gross domestic product (Y2000=100) irate deposit interest rate Example 1: 1980-2010 for 122 countries Example 2: 2003-2010 for 104-108 countries : Source:http://databank.worldbank.org/data/Home.aspx

Gustavo Sanchez (StataCorp)

June 22-23, 2012

9 / 42


Panel Data Linear Models Fitting the model in Stata Empirical example - Specifying the panel structure in Stata

Specifying the panel structure in Stata Assuming that the second dimension corresponds to time series, we use the -xtset- command to specify the panel structure with: Panel identifier variable (e.g. country) Time identifier variable (e.g. year)

. xtset country year panel variable: time variable: delta:

Gustavo Sanchez (StataCorp)

country (unbalanced) year, 1980 to 2010, but with gaps 1 unit

June 22-23, 2012

10 / 42


Panel Data Linear Models Fitting the model in Stata Empirical example - Specifying the panel structure in Stata

Specifying the panel structure in Stata Assuming that the second dimension corresponds to time series, we use the -xtset- command to specify the panel structure with: Panel identifier variable (e.g. country) Time identifier variable (e.g. year)

. xtset country year panel variable: time variable: delta:

Gustavo Sanchez (StataCorp)

country (unbalanced) year, 1980 to 2010, but with gaps 1 unit

June 22-23, 2012

10 / 42


Panel Data Linear Models Fitting the model in Stata Empirical example - Specifying the panel structure in Stata

Specifying the panel structure in Stata Assuming that the second dimension corresponds to time series, we use the -xtset- command to specify the panel structure with: Panel identifier variable (e.g. country) Time identifier variable (e.g. year)

. xtset country year panel variable: time variable: delta:

Gustavo Sanchez (StataCorp)

country (unbalanced) year, 1980 to 2010, but with gaps 1 unit

June 22-23, 2012

10 / 42


Panel Data Linear Models Fitting the model in Stata Empirical example - Fixed effects

Fixed effects linear model . xtreg lconsumo lpib lirate,fe Fixed-effects (within) regression Group variable: country R-sq: within = 0.9368 between = 0.9943 overall = 0.9929 corr(u_i, Xb)

Number of obs Number of groups Obs per group: min avg max F(2,2777) Prob > F

= 0.3537

lconsumo

Coef.

lpib lirate _cons

.9399169 -.0041257 1.218756

.0052705 .002125 .1274414

sigma_u sigma_e rho

.16078074 .07814221 .80892226

(fraction of variance due to u_i)

F test that all u_i=0:

Std. Err.

t 178.34 -1.94 9.56

F(121, 2777) =

Gustavo Sanchez (StataCorp)

P>|t| 0.000 0.052 0.000

93.89

June 22-23, 2012

= = = = = = =

2901 122 11 23.8 31 20586.83 0.0000

[95% Conf. Interval] .9295824 -.0082925 .9688669

.9502514 .000041 1.468646

Prob > F = 0.0000

11 / 42


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity

Testing and accounting for serial correlation and heteroskedasticity

http://www.stata.com/support/faqs/stat/panel.html Gustavo Sanchez (StataCorp)

June 22-23, 2012

12 / 42


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity Empirical example - Test for autocorrelation

Test for autocorrelation: Wooldridge (2002, pag. 2823) derives a simple test for autocorrelation in panel-data models. Regress the pooled (OLS) model in first difference and predict the residuals Regress the residuals on its first lag and test the coefficient on those lagged residuals

Drukker (2003) implements the test with the user-written command -xtserial. xtserial lconsumo lpib lirate if e(sample) Wooldridge test for autocorrelation in panel data H0: no first-order autocorrelation F( 1, 121) = 103.854 Prob > F = 0.0000

Gustavo Sanchez (StataCorp)

June 22-23, 2012

13 / 42


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity Empirical example - Test for autocorrelation

Test for autocorrelation: Wooldridge (2002, pag. 2823) derives a simple test for autocorrelation in panel-data models. Regress the pooled (OLS) model in first difference and predict the residuals Regress the residuals on its first lag and test the coefficient on those lagged residuals

Drukker (2003) implements the test with the user-written command -xtserial. xtserial lconsumo lpib lirate if e(sample) Wooldridge test for autocorrelation in panel data H0: no first-order autocorrelation F( 1, 121) = 103.854 Prob > F = 0.0000

Gustavo Sanchez (StataCorp)

June 22-23, 2012

13 / 42


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity Empirical example - Test for autocorrelation

Test for autocorrelation: Wooldridge (2002, pag. 2823) derives a simple test for autocorrelation in panel-data models. Regress the pooled (OLS) model in first difference and predict the residuals Regress the residuals on its first lag and test the coefficient on those lagged residuals

Drukker (2003) implements the test with the user-written command -xtserial. xtserial lconsumo lpib lirate if e(sample) Wooldridge test for autocorrelation in panel data H0: no first-order autocorrelation F( 1, 121) = 103.854 Prob > F = 0.0000

Gustavo Sanchez (StataCorp)

June 22-23, 2012

13 / 42


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity Empirical example - Test for heteroskedasticity

Test for heteroskedasticity: Poi and Wiggins (2001) suggest an LR test for panel-level heteroskedasticity: iterated GLS with heteroskedastic panels produces MLE. Thus, we can use a LR test with -xtgls, igls panels(heteroskdastic)- versus -xtgls, igls. quietly xtgls lconsumo . estimates store hetero . quietly xtgls lconsumo . estimates store homosk . local df = e(N_g) - 1 . . lrtest hetero homosk , Likelihood-ratio test (Assumption: homosk nested

lpib

lirate, panels(heterosk) igls

lpib

lirate, igls

df(`df´) in hetero)

Gustavo Sanchez (StataCorp)

June 22-23, 2012

LR chi2(121)= Prob > chi2 =

14 / 42

3428.91 0.0000


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity Empirical example - Test for heteroskedasticity

Test for heteroskedasticity: Poi and Wiggins (2001) suggest an LR test for panel-level heteroskedasticity: iterated GLS with heteroskedastic panels produces MLE. Thus, we can use a LR test with -xtgls, igls panels(heteroskdastic)- versus -xtgls, igls. quietly xtgls lconsumo . estimates store hetero . quietly xtgls lconsumo . estimates store homosk . local df = e(N_g) - 1 . . lrtest hetero homosk , Likelihood-ratio test (Assumption: homosk nested

lpib

lirate, panels(heterosk) igls

lpib

lirate, igls

df(`df´) in hetero)

Gustavo Sanchez (StataCorp)

June 22-23, 2012

LR chi2(121)= Prob > chi2 =

14 / 42

3428.91 0.0000


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity Empirical example - Test for heteroskedasticity

Test for heteroskedasticity: Poi and Wiggins (2001) suggest an LR test for panel-level heteroskedasticity: iterated GLS with heteroskedastic panels produces MLE. Thus, we can use a LR test with -xtgls, igls panels(heteroskdastic)- versus -xtgls, igls. quietly xtgls lconsumo . estimates store hetero . quietly xtgls lconsumo . estimates store homosk . local df = e(N_g) - 1 . . lrtest hetero homosk , Likelihood-ratio test (Assumption: homosk nested

lpib

lirate, panels(heterosk) igls

lpib

lirate, igls

df(`df´) in hetero)

Gustavo Sanchez (StataCorp)

June 22-23, 2012

LR chi2(121)= Prob > chi2 =

14 / 42

3428.91 0.0000


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity Empirical example - Test for heteroskedasticity

Test for heteroskedasticity: Poi and Wiggins (2001) suggest an LR test for panel-level heteroskedasticity: iterated GLS with heteroskedastic panels produces MLE. Thus, we can use a LR test with -xtgls, igls panels(heteroskdastic)- versus -xtgls, igls. quietly xtgls lconsumo . estimates store hetero . quietly xtgls lconsumo . estimates store homosk . local df = e(N_g) - 1 . . lrtest hetero homosk , Likelihood-ratio test (Assumption: homosk nested

lpib

lirate, panels(heterosk) igls

lpib

lirate, igls

df(`df´) in hetero)

Gustavo Sanchez (StataCorp)

June 22-23, 2012

LR chi2(121)= Prob > chi2 =

14 / 42

3428.91 0.0000


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity One-way linear AR(1) model

Linear model with first order autoregressive error term -xtregar-: Yit = α + Xit1 ∗ β1 + ... + XitK ∗ βK + µi + νit νit = ρ ∗ νit−1 + ηit

;

η is iid(0, ση2 )

Some Relevant Assumptions Fixed effects: The non-observable individual effects (µi ) are represented by fixed parameters and may be correlated with the covariates in X. Random effects: The non-observable individual effects are assumed to be independent of the idiosyncratic error term and they are also independent of the covariates in X. The µi are iid(0,σµ2 )

Gustavo Sanchez (StataCorp)

June 22-23, 2012

15 / 42


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity One-way linear AR(1) model

Linear model with first order autoregressive error term -xtregar-: Yit = α + Xit1 ∗ β1 + ... + XitK ∗ βK + µi + νit νit = ρ ∗ νit−1 + ηit

;

η is iid(0, ση2 )

Some Relevant Assumptions Fixed effects: The non-observable individual effects (µi ) are represented by fixed parameters and may be correlated with the covariates in X. Random effects: The non-observable individual effects are assumed to be independent of the idiosyncratic error term and they are also independent of the covariates in X. The µi are iid(0,σµ2 )

Gustavo Sanchez (StataCorp)

June 22-23, 2012

15 / 42


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity One-way linear AR(1) model

Linear model with first order autoregressive error term -xtregar-: Yit = α + Xit1 ∗ β1 + ... + XitK ∗ βK + µi + νit νit = ρ ∗ νit−1 + ηit

;

η is iid(0, ση2 )

Some Relevant Assumptions Fixed effects: The non-observable individual effects (µi ) are represented by fixed parameters and may be correlated with the covariates in X. Random effects: The non-observable individual effects are assumed to be independent of the idiosyncratic error term and they are also independent of the covariates in X. The µi are iid(0,σµ2 )

Gustavo Sanchez (StataCorp)

June 22-23, 2012

15 / 42


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity Empirical example - Fixed effects AR(1) model

Fit model accounting for autocorrelation . xtregar lconsumo lpib lirate, fe FE (within) regression with AR(1) disturbances Group variable: country R-sq: within = 0.9631 between = 0.9941 overall = 0.9930 corr(u_i, Xb)

= -0.2531

lconsumo

Coef.

lpib lirate _cons

.9887413 -.000825 .0431147

rho_ar sigma_u sigma_e rho_fov

.82953965 .15647357 .04443063 .92538831

F test that all u_i=0:

Std. Err. .0037579 .0021888 .015465

t

Number of obs Number of groups Obs per group: min avg max F(2,2655) Prob > F P>|t|

263.11 -0.38 2.79

0.000 0.706 0.005

= = = = = = =

2779 122 10 22.8 30 34634.76 0.0000

[95% Conf. Interval] .9813726 -.0051168 .01279

.99611 .0034668 .0734394

(fraction of variance because of u_i) F(121,2655) =

Gustavo Sanchez (StataCorp)

9.24

June 22-23, 2012

Prob > F = 0.0000

16 / 42


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity Feasible Generalized Least Squares (FGLS)

Feasible Generalized Least Squares (-xtgls-): Yit = Îą + Xit1 ∗ β1 + ... + XitK ∗ βK + it Where the variance matrix of the disturbances would be :   Ďƒ11 â„Ś11 Ďƒ12 â„Ś12 ¡ ¡ ¡ Ďƒ1m â„Ś1m  Ďƒ21 â„Ś21 Ďƒ22 â„Ś22 ¡ ¡ ¡ Ďƒ2m â„Ś2m    E [ ] = â„Ś =   .. .. .. ..   . . . . Ďƒm1 â„Śm1 Ďƒm2 â„Śm2 ¡ ¡ ¡ Ďƒmm â„Śmm Different variance-covariance structures Heteroskedasticity across panels Correlation across panels Autocorrelation within panels Gustavo Sanchez (StataCorp)

June 22-23, 2012

17 / 42


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity Feasible Generalized Least Squares (FGLS)

Feasible Generalized Least Squares (-xtgls-): Yit = Îą + Xit1 ∗ β1 + ... + XitK ∗ βK + it Where the variance matrix of the disturbances would be :   Ďƒ11 â„Ś11 Ďƒ12 â„Ś12 ¡ ¡ ¡ Ďƒ1m â„Ś1m  Ďƒ21 â„Ś21 Ďƒ22 â„Ś22 ¡ ¡ ¡ Ďƒ2m â„Ś2m    E [ ] = â„Ś =   .. .. .. ..   . . . . Ďƒm1 â„Śm1 Ďƒm2 â„Śm2 ¡ ¡ ¡ Ďƒmm â„Śmm Different variance-covariance structures Heteroskedasticity across panels Correlation across panels Autocorrelation within panels Gustavo Sanchez (StataCorp)

June 22-23, 2012

17 / 42


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity Feasible Generalized Least Squares (FGLS)

Feasible Generalized Least Squares (-xtgls-): Yit = Îą + Xit1 ∗ β1 + ... + XitK ∗ βK + it Where the variance matrix of the disturbances would be :   Ďƒ11 â„Ś11 Ďƒ12 â„Ś12 ¡ ¡ ¡ Ďƒ1m â„Ś1m  Ďƒ21 â„Ś21 Ďƒ22 â„Ś22 ¡ ¡ ¡ Ďƒ2m â„Ś2m    E [ ] = â„Ś =   .. .. .. ..   . . . . Ďƒm1 â„Śm1 Ďƒm2 â„Śm2 ¡ ¡ ¡ Ďƒmm â„Śmm Different variance-covariance structures Heteroskedasticity across panels Correlation across panels Autocorrelation within panels Gustavo Sanchez (StataCorp)

June 22-23, 2012

17 / 42


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity Feasible Generalized Least Squares (FGLS)

Feasible Generalized Least Squares (-xtgls-): Yit = Îą + Xit1 ∗ β1 + ... + XitK ∗ βK + it Where the variance matrix of the disturbances would be :   Ďƒ11 â„Ś11 Ďƒ12 â„Ś12 ¡ ¡ ¡ Ďƒ1m â„Ś1m  Ďƒ21 â„Ś21 Ďƒ22 â„Ś22 ¡ ¡ ¡ Ďƒ2m â„Ś2m    E [ ] = â„Ś =   .. .. .. ..   . . . . Ďƒm1 â„Śm1 Ďƒm2 â„Śm2 ¡ ¡ ¡ Ďƒmm â„Śmm Different variance-covariance structures Heteroskedasticity across panels Correlation across panels Autocorrelation within panels Gustavo Sanchez (StataCorp)

June 22-23, 2012

17 / 42


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity Feasible Generalized Least Squares (FGLS)

Feasible Generalized Least Squares -xtgls-: Yit = Îą + Xit1 ∗ β1 + ... + XitK ∗ βK + it Heteroskedasticity across panels -xtgls,panels(heteroskedastic)-:

   E [ ] = â„Ś =  

Gustavo Sanchez (StataCorp)

Ďƒ1 I 0 .. .

0 Ďƒ2 I .. .

¡¡¡ ¡¡¡ .. .

0 0 .. .

0

0

¡¡¡

Ďƒm I

June 22-23, 2012

    

18 / 42


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity Feasible Generalized Least Squares (FGLS)

Feasible Generalized Least Squares -xtgls-: Yit = Îą + Xit1 ∗ β1 + ... + XitK ∗ βK + it it = Ď âˆ— it−1 + Ρit

;

Ρ is iid(0, ĎƒΡ2 )

Heteroskedasticity across panels and autocorrelation within panels -xtgls,panels(heteroskedastic) corr(psar1)-:

   E [ ] = â„Ś =  

Ďƒ1 â„Ś11 0 ¡¡¡ 0 Ďƒ2 â„Ś22 ¡ ¡ ¡ .. .. .. . . . 0 0 ¡¡¡

Gustavo Sanchez (StataCorp)

June 22-23, 2012

0 0 .. .

    

Ďƒm â„Śmm

19 / 42


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity Empirical example - Fit model accounting for heteroskedasticity

Fit model accounting for heteroskedasticity . xtgls lconsumo lpib lirate,panels(heterosk) Cross-sectional time-series FGLS regression Coefficients: generalized least squares Panels: heteroskedastic Correlation: no autocorrelation Estimated covariances = 122 Estimated autocorrelations = 0 Estimated coefficients = 3

lconsumo

Coef.

lpib lirate _cons

.9720376 .0193624 .4192768

Std. Err. .000853 .0013921 .0215707

z 1139.53 13.91 19.44

nolog

Number of obs Number of groups Obs per group: min avg max Wald chi2(2) Prob > chi2

= = = = = = =

2901 122 11 23.77869 31 1352635 0.0000

P>|z|

[95% Conf. Interval]

0.000 0.000 0.000

.9703657 .016634 .376999

.9737094 .0220908 .4615545

.

Gustavo Sanchez (StataCorp)

June 22-23, 2012

20 / 42


Panel Data Linear Models Testing and accounting for serial correlation and heteroskedasticity Empirical example - Fit model accounting for autocorrelation and heteroskedasticity

Fit model accounting for autocorrelation and heteroskedasticity . xtgls lconsumo lpib lirate,panels(heterosk) corr(psar1) nolog force Cross-sectional time-series FGLS regression Coefficients: generalized least squares Panels: heteroskedastic Correlation: panel-specific AR(1) Estimated covariances = 122 Number of obs = 2901 Estimated autocorrelations = 122 Number of groups = 122 Estimated coefficients = 3 Obs per group: min = 11 avg = 23.77869 max = 31 Wald chi2(2) = 255484.88 Prob > chi2 = 0.0000 lconsumo

Coef.

lpib lirate _cons

.957914 -.0009035 .7854506

Std. Err. .0019214 .0009393 .0472898

z 498.54 -0.96 16.61

P>|z| 0.000 0.336 0.000

[95% Conf. Interval] .9541481 -.0027444 .6927643

.96168 .0009375 .8781369

. Gustavo Sanchez (StataCorp)

June 22-23, 2012

21 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences

Panel unit root tests - Model in first differences

Gustavo Sanchez (StataCorp)

June 22-23, 2012

22 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Empirical example - Plot variables in log-levels

Command lines to plot the the variables in levels (per panel) . > > > > > .

xtline lconsumo if country==9 | country==25 | country==28 | country==42 | country==44 | country==61 | country==87 | country==146 | country==176 | country==179 | country==238 | country==241, name(lconsumo) byopts(t1title("Log of Consumo for selected countries 1980-2010") note("Command: xtline lconsumo if country==**,[options]"))

Gustavo Sanchez (StataCorp)

June 22-23, 2012

/// /// /// /// ///

23 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Empirical example - Plot variables in log-levels

Gustavo Sanchez (StataCorp)

June 22-23, 2012

24 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Empirical example - Plot variables in log-levels

Gustavo Sanchez (StataCorp)

June 22-23, 2012

25 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Empirical example - Plot variables in log-levels

Gustavo Sanchez (StataCorp)

June 22-23, 2012

26 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Panel unit root - Fisher-type test

Fisher-type Test

(xtunitroot fisher)

Ho: All the panels have unit roots H1: At least one panel does not have unit roots (N finite), or some panels do not have unit roots (N → ∞) Allows unbalanced panels and gaps in any panel Performs Dickey-Fuller or Phillips-Perron test for each panel Combines p-values from the panel specific unit root tests Four different tests reported in the output. All tests are for T → ∞ P is for finite N Z, L*, and PM are are valid for N finite or infinite

Gustavo Sanchez (StataCorp)

June 22-23, 2012

27 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Panel unit root - Fisher-type test

Fisher-type Test

(xtunitroot fisher)

Ho: All the panels have unit roots H1: At least one panel does not have unit roots (N finite), or some panels do not have unit roots (N → ∞) Allows unbalanced panels and gaps in any panel Performs Dickey-Fuller or Phillips-Perron test for each panel Combines p-values from the panel specific unit root tests Four different tests reported in the output. All tests are for T → ∞ P is for finite N Z, L*, and PM are are valid for N finite or infinite

Gustavo Sanchez (StataCorp)

June 22-23, 2012

27 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Panel unit root - Fisher-type test

Fisher-type Test

(xtunitroot fisher)

Ho: All the panels have unit roots H1: At least one panel does not have unit roots (N finite), or some panels do not have unit roots (N → ∞) Allows unbalanced panels and gaps in any panel Performs Dickey-Fuller or Phillips-Perron test for each panel Combines p-values from the panel specific unit root tests Four different tests reported in the output. All tests are for T → ∞ P is for finite N Z, L*, and PM are are valid for N finite or infinite

Gustavo Sanchez (StataCorp)

June 22-23, 2012

27 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Panel unit root - Fisher-type test

Fisher-type Test

(xtunitroot fisher)

Ho: All the panels have unit roots H1: At least one panel does not have unit roots (N finite), or some panels do not have unit roots (N → ∞) Allows unbalanced panels and gaps in any panel Performs Dickey-Fuller or Phillips-Perron test for each panel Combines p-values from the panel specific unit root tests Four different tests reported in the output. All tests are for T → ∞ P is for finite N Z, L*, and PM are are valid for N finite or infinite

Gustavo Sanchez (StataCorp)

June 22-23, 2012

27 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Panel unit root - Fisher-type test

Fisher-type Test

(xtunitroot fisher)

Ho: All the panels have unit roots H1: At least one panel does not have unit roots (N finite), or some panels do not have unit roots (N → ∞) Allows unbalanced panels and gaps in any panel Performs Dickey-Fuller or Phillips-Perron test for each panel Combines p-values from the panel specific unit root tests Four different tests reported in the output. All tests are for T → ∞ P is for finite N Z, L*, and PM are are valid for N finite or infinite

Gustavo Sanchez (StataCorp)

June 22-23, 2012

27 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Empirical example - Panel unit root - Fisher-type test

Panel unit root Fisher type test for consumption . xtunitroot fisher lconsumo if e(sample),dfuller lags(1) Fisher-type unit-root test for lconsumo Based on augmented Dickey-Fuller tests Ho: All panels contain unit roots Ha: At least one panel is stationary AR parameter: Panel-specific Panel means: Included Time trend: Not included Drift term: Not included

Inverse chi-squared(244) Inverse normal Inverse logit t(614) Modified inv. chi-squared

P Z L* Pm

Number of panels = 122 Avg. number of periods = 22.68 Asymptotics: T -> Infinity

ADF regressions: 1 lag

Statistic

p-value

121.6417 12.7187 12.5789 -5.5389

1.0000 1.0000 1.0000 1.0000

P statistic requires number of panels to be finite. Other statistics are suitable for finite or infinite number of panels.

Gustavo Sanchez (StataCorp)

June 22-23, 2012

28 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Empirical example - Panel unit root - Fisher-type test

Panel unit root Fisher type test for gross domestic product . xtunitroot fisher lpib if e(sample),dfuller lags(1) Fisher-type unit-root test for lpib Based on augmented Dickey-Fuller tests Ho: All panels contain unit roots Ha: At least one panel is stationary AR parameter: Panel-specific Panel means: Included Time trend: Not included Drift term: Not included

Inverse chi-squared(244) Inverse normal Inverse logit t(604) Modified inv. chi-squared

P Z L* Pm

Number of panels = 122 Avg. number of periods = 22.68 Asymptotics: T -> Infinity

ADF regressions: 1 lag

Statistic

p-value

97.1014 11.9780 12.5444 -6.6498

1.0000 1.0000 1.0000 1.0000

P statistic requires number of panels to be finite. Other statistics are suitable for finite or infinite number of panels.

Gustavo Sanchez (StataCorp)

June 22-23, 2012

29 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Empirical example - Panel unit root - Fisher-type test

Panel unit root Fisher type test for interest rate . xtunitroot fisher lirate if e(sample),dfuller lags(1) Fisher-type unit-root test for lirate Based on augmented Dickey-Fuller tests Ho: All panels contain unit roots Ha: At least one panel is stationary AR parameter: Panel-specific Panel means: Included Time trend: Not included Drift term: Not included

Inverse chi-squared(244) Inverse normal Inverse logit t(609) Modified inv. chi-squared

P Z L* Pm

Number of panels = 122 Avg. number of periods = 22.68 Asymptotics: T -> Infinity

ADF regressions: 1 lag

Statistic

p-value

256.2905 2.9384 2.2199 0.5564

0.2819 0.9984 0.9866 0.2890

P statistic requires number of panels to be finite. Other statistics are suitable for finite or infinite number of panels.

Gustavo Sanchez (StataCorp)

June 22-23, 2012

30 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Empirical example - Model in first difference

Model in first difference . xtreg D.lconsumo D.lpib D.lirate, fe vsquish Fixed-effects (within) regression Number of obs Group variable: country Number of groups R-sq: within = 0.3177 Obs per group: min between = 0.7577 avg overall = 0.3552 max F(2,2513) corr(u_i, Xb) = -0.0126 Prob > F D.lconsumo

Coef.

Std. Err.

t

= = = = = = =

2637 122 9 21.6 29 585.16 0.0000

P>|t|

[95% Conf. Interval]

lpib D1. lirate D1. _cons

.8089838

.0236943

34.14

0.000

.7625214

.8554462

-.0034948 .0051172

.0022693 .0012508

-1.54 4.09

0.124 0.000

-.0079447 .0026646

.0009551 .0075699

sigma_u sigma_e rho

.00820494 .04523059 .03185848

(fraction of variance due to u_i)

F test that all u_i=0:

F(121, 2513) =

Gustavo Sanchez (StataCorp)

0.60

June 22-23, 2012

Prob > F = 0.9998

31 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Empirical example - Serial correlation and heteroskedasticity tests for the model in first difference

Serial correlation test for the model in first difference . xtserial dlconsumo dlpib dlirate Wooldridge test for autocorrelation in panel data H0: no first-order autocorrelation F( 1, 121) = 0.333 Prob > F = 0.5647

Heteroskedasticity test for the model in first difference . lrtest hetero homosk , df(`df´) Likelihood-ratio test (Assumption: homosk nested in hetero)

Gustavo Sanchez (StataCorp)

LR chi2(121)= Prob > chi2 =

June 22-23, 2012

2582.04 0.0000

32 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Empirical example - Serial correlation and heteroskedasticity tests for the model in first difference

Serial correlation test for the model in first difference . xtserial dlconsumo dlpib dlirate Wooldridge test for autocorrelation in panel data H0: no first-order autocorrelation F( 1, 121) = 0.333 Prob > F = 0.5647

Heteroskedasticity test for the model in first difference . lrtest hetero homosk , df(`df´) Likelihood-ratio test (Assumption: homosk nested in hetero)

Gustavo Sanchez (StataCorp)

LR chi2(121)= Prob > chi2 =

June 22-23, 2012

2582.04 0.0000

32 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Empirical example - FE model in first difference with robust standard errors

FE model in first difference with robust standard errors . xtreg D.lconsumo D.lpib D.lirate, fe robust vsquish Fixed-effects (within) regression Number of obs Group variable: country Number of groups R-sq: within = 0.3177 Obs per group: min between = 0.7577 avg overall = 0.3552 max F(2,121) corr(u_i, Xb) = -0.0126 Prob > F (Std. Err. adjusted for 122 clusters

D.lconsumo

Coef.

Robust Std. Err.

t

= 2637 = 122 = 9 = 21.6 = 29 = 241.80 = 0.0000 in country)

P>|t|

[95% Conf. Interval]

lpib D1. lirate D1. _cons

.8089838

.0371275

21.79

0.000

.7354802

.8824874

-.0034948 .0051172

.001886 .0013755

-1.85 3.72

0.066 0.000

-.0072286 .0023942

.000239 .0078403

sigma_u sigma_e rho

.00820494 .04523059 .03185848

(fraction of variance due to u_i)

Gustavo Sanchez (StataCorp)

June 22-23, 2012

33 / 42


Panel Data Linear Models Panel unit root tests - Model in first differences Empirical example - FGLS Model in first difference accounting for heteroskedasticity

FGLS model in first difference accounting for heteroskedasticity . xtgls D.lconsumo D.lpib D.lirate, panels(heterosk) nolog Cross-sectional time-series FGLS regression Coefficients: generalized least squares Panels: heteroskedastic Correlation: no autocorrelation Estimated covariances = 122 Number of obs Estimated autocorrelations = 0 Number of groups Estimated coefficients = 3 Obs per group: min avg max Wald chi2(2) Prob > chi2 D.lconsumo

Coef.

Std. Err.

lpib D1.

.7983589

.0118107

lirate D1.

-.0043501

_cons

.0042671

2637 122 9 21.61475 29 4586.70 0.0000

P>|z|

[95% Conf. Interval]

67.60

0.000

.7752104

.8215073

.0008465

-5.14

0.000

-.0060092

-.002691

.0004889

8.73

0.000

.0033089

.0052253

Gustavo Sanchez (StataCorp)

z

= = = = = = =

June 22-23, 2012

34 / 42


Panel Data Linear Models Dynamic panel linear models

Dynamic Panel Linear Models

Gustavo Sanchez (StataCorp)

June 22-23, 2012

35 / 42


Panel Data Linear Models Dynamic panel linear models

Dynamic Panel Linear Model Yit =

p X

δj ∗ Yit−j +

j=1

K X

Xitk ∗ βk + it

;

it = ¾i + νit

k=1

Basic problems Yit is a function of Âľi ⇒ Yit−1 is a function of Âľi . Thus, OLS is biased because corr ( it , Yit−1 ) 6= 0. The within transformation for FE wipes out Âľi . However, ( ÂŻi ) contains it−1 , which is in turn correlated with Yit−1 . The fixed effects estimator is then biased of order O(1/T) and inconsistent for large N and fixed T

Gustavo Sanchez (StataCorp)

June 22-23, 2012

36 / 42


Panel Data Linear Models Dynamic panel linear models

Dynamic Panel Linear Model Yit =

p X

δj ∗ Yit−j +

j=1

K X

Xitk ∗ βk + it

;

it = ¾i + νit

k=1

Basic problems Yit is a function of Âľi ⇒ Yit−1 is a function of Âľi . Thus, OLS is biased because corr ( it , Yit−1 ) 6= 0. The within transformation for FE wipes out Âľi . However, ( ÂŻi ) contains it−1 , which is in turn correlated with Yit−1 . The fixed effects estimator is then biased of order O(1/T) and inconsistent for large N and fixed T

Gustavo Sanchez (StataCorp)

June 22-23, 2012

36 / 42


Panel Data Linear Models Dynamic panel linear models

Dynamic Panel Linear Model Yit =

p X

δj ∗ Yit−j +

j=1

K X

Xitk ∗ βk + it

;

it = ¾i + νit

k=1

Basic problems Yit is a function of Âľi ⇒ Yit−1 is a function of Âľi . Thus, OLS is biased because corr ( it , Yit−1 ) 6= 0. The within transformation for FE wipes out Âľi . However, ( ÂŻi ) contains it−1 , which is in turn correlated with Yit−1 . The fixed effects estimator is then biased of order O(1/T) and inconsistent for large N and fixed T

Gustavo Sanchez (StataCorp)

June 22-23, 2012

36 / 42


Panel Data Linear Models Dynamic panel linear models Arellano-Bond Arellano-Bover/Blundell-Bond

Arellano-Bond GMM-IV estimator The formulation departs from a fixed effects specification but the model is fitted in first differences and, therefore, the fixed effects are removed from the estimation. The estimator is based on a matrix of instruments constructed with the exogenous variables, and also with subsets of the lagged values of the levels of dependent variable and of the levels of the endogenous or predetermined variables.

Arellano-Bover/Blundell-Bond GMM system estimator They extend the model to a system containing the equation in first differences and also an equation in levels. The new matrix of instruments is constructed including instruments in levels for the equation in differences and instruments in first differences for the equation in levels.

Gustavo Sanchez (StataCorp)

June 22-23, 2012

37 / 42


Panel Data Linear Models Dynamic panel linear models Arellano-Bond Arellano-Bover/Blundell-Bond

Arellano-Bond GMM-IV estimator The formulation departs from a fixed effects specification but the model is fitted in first differences and, therefore, the fixed effects are removed from the estimation. The estimator is based on a matrix of instruments constructed with the exogenous variables, and also with subsets of the lagged values of the levels of dependent variable and of the levels of the endogenous or predetermined variables.

Arellano-Bover/Blundell-Bond GMM system estimator They extend the model to a system containing the equation in first differences and also an equation in levels. The new matrix of instruments is constructed including instruments in levels for the equation in differences and instruments in first differences for the equation in levels.

Gustavo Sanchez (StataCorp)

June 22-23, 2012

37 / 42


Panel Data Linear Models Dynamic panel linear models Arellano-Bond Arellano-Bover/Blundell-Bond

Arellano-Bond GMM-IV estimator The formulation departs from a fixed effects specification but the model is fitted in first differences and, therefore, the fixed effects are removed from the estimation. The estimator is based on a matrix of instruments constructed with the exogenous variables, and also with subsets of the lagged values of the levels of dependent variable and of the levels of the endogenous or predetermined variables.

Arellano-Bover/Blundell-Bond GMM system estimator They extend the model to a system containing the equation in first differences and also an equation in levels. The new matrix of instruments is constructed including instruments in levels for the equation in differences and instruments in first differences for the equation in levels.

Gustavo Sanchez (StataCorp)

June 22-23, 2012

37 / 42


Panel Data Linear Models Dynamic panel linear models Arellano-Bond Arellano-Bover/Blundell-Bond

Arellano-Bond GMM-IV estimator The formulation departs from a fixed effects specification but the model is fitted in first differences and, therefore, the fixed effects are removed from the estimation. The estimator is based on a matrix of instruments constructed with the exogenous variables, and also with subsets of the lagged values of the levels of dependent variable and of the levels of the endogenous or predetermined variables.

Arellano-Bover/Blundell-Bond GMM system estimator They extend the model to a system containing the equation in first differences and also an equation in levels. The new matrix of instruments is constructed including instruments in levels for the equation in differences and instruments in first differences for the equation in levels.

Gustavo Sanchez (StataCorp)

June 22-23, 2012

37 / 42


Panel Data Linear Models Dynamic panel linear models Arellano-Bond Arellano-Bover/Blundell-Bond

Arellano-Bond GMM-IV estimator The formulation departs from a fixed effects specification but the model is fitted in first differences and, therefore, the fixed effects are removed from the estimation. The estimator is based on a matrix of instruments constructed with the exogenous variables, and also with subsets of the lagged values of the levels of dependent variable and of the levels of the endogenous or predetermined variables.

Arellano-Bover/Blundell-Bond GMM system estimator They extend the model to a system containing the equation in first differences and also an equation in levels. The new matrix of instruments is constructed including instruments in levels for the equation in differences and instruments in first differences for the equation in levels.

Gustavo Sanchez (StataCorp)

June 22-23, 2012

37 / 42


Panel Data Linear Models Dynamic panel linear models Empirical example

Model for aggregate consumption consumoit = α+consumoit−1 ∗β2 +pibit ∗β1 +irateit ∗β3 +µi +νit Data World Bank public online data on: consumo: Final consumption expenditure (Y2000=100) pib: Gross domestic product (Y2000=100) irate deposit interest rate Example 2: 2003-2010 for 104-108 countries : Source:http://databank.worldbank.org/data/Home.aspx

Gustavo Sanchez (StataCorp)

June 22-23, 2012

38 / 42


Panel Data Linear Models Dynamic panel linear models Empirical example

Model for aggregate consumption consumoit = α+consumoit−1 ∗β2 +pibit ∗β1 +irateit ∗β3 +µi +νit The presence of lags of the dependent variable among the regressors requires fitting the model with dynamic panel data estimators. -xtivreg,fd-: Anderson and Hsiao (1981) first difference estimator. -xtabond-: Arellano Bond (1991) GMM estimator. -xtdpdsys-: Arellano-Bover (1995) - Blundell-Bond (1998) GMM estimator. -xtdpd- generalizes -xtabond- and -xtdpdsys-.

Gustavo Sanchez (StataCorp)

June 22-23, 2012

39 / 42


Panel Data Linear Models Dynamic panel linear models Empirical example

Model for aggregate consumption consumoit = α+consumoit−1 ∗β2 +pibit ∗β1 +irateit ∗β3 +µi +νit The presence of lags of the dependent variable among the regressors requires fitting the model with dynamic panel data estimators. -xtivreg,fd-: Anderson and Hsiao (1981) first difference estimator. -xtabond-: Arellano Bond (1991) GMM estimator. -xtdpdsys-: Arellano-Bover (1995) - Blundell-Bond (1998) GMM estimator. -xtdpd- generalizes -xtabond- and -xtdpdsys-.

Gustavo Sanchez (StataCorp)

June 22-23, 2012

39 / 42


Panel Data Linear Models Dynamic panel linear models Empirical example

Model for aggregate consumption consumoit = α+consumoit−1 ∗β2 +pibit ∗β1 +irateit ∗β3 +µi +νit The presence of lags of the dependent variable among the regressors requires fitting the model with dynamic panel data estimators. -xtivreg,fd-: Anderson and Hsiao (1981) first difference estimator. -xtabond-: Arellano Bond (1991) GMM estimator. -xtdpdsys-: Arellano-Bover (1995) - Blundell-Bond (1998) GMM estimator. -xtdpd- generalizes -xtabond- and -xtdpdsys-.

Gustavo Sanchez (StataCorp)

June 22-23, 2012

39 / 42


Panel Data Linear Models Dynamic panel linear models Empirical example

Model for aggregate consumption consumoit = α+consumoit−1 ∗β2 +pibit ∗β1 +irateit ∗β3 +µi +νit The presence of lags of the dependent variable among the regressors requires fitting the model with dynamic panel data estimators. -xtivreg,fd-: Anderson and Hsiao (1981) first difference estimator. -xtabond-: Arellano Bond (1991) GMM estimator. -xtdpdsys-: Arellano-Bover (1995) - Blundell-Bond (1998) GMM estimator. -xtdpd- generalizes -xtabond- and -xtdpdsys-.

Gustavo Sanchez (StataCorp)

June 22-23, 2012

39 / 42


Panel Data Linear Models Dynamic panel linear models Empirical example

Model for aggregate consumption consumoit = α+consumoit−1 ∗β2 +pibit ∗β1 +irateit ∗β3 +µi +νit The presence of lags of the dependent variable among the regressors requires fitting the model with dynamic panel data estimators. -xtivreg,fd-: Anderson and Hsiao (1981) first difference estimator. -xtabond-: Arellano Bond (1991) GMM estimator. -xtdpdsys-: Arellano-Bover (1995) - Blundell-Bond (1998) GMM estimator. -xtdpd- generalizes -xtabond- and -xtdpdsys-.

Gustavo Sanchez (StataCorp)

June 22-23, 2012

39 / 42


Panel Data Linear Models Dynamic panel linear models Empirical example - Arellano-Bond

Arellano-Bond . xtabond lconsumo lpib lirate ,lags(1) maxldep(4) vsquish Arellano-Bond dynamic panel-data estimation Number of obs Group variable: country Number of groups Time variable: year Obs per group:

Number of instruments =

21

Wald chi2(3) Prob > chi2

= =

550 104

min = avg = max = = =

1 5.288462 6 5583.65 0.0000

One-step results lconsumo

Coef.

lconsumo L1. lpib lirate _cons

.2003175 .7843574 -.0109575 .2193715

Std. Err.

.036051 .0394084 .0032787 .3215974

z

5.56 19.90 -3.34 0.68

P>|z|

0.000 0.000 0.001 0.495

[95% Conf. Interval]

.1296588 .7071183 -.0173837 -.4109479

.2709762 .8615965 -.0045313 .8496908

Instruments for differenced equation GMM-type: L(2/5).lconsumo Standard: D.lpib D.lirate Instruments for level equation Standard: _cons Gustavo Sanchez (StataCorp)

June 22-23, 2012

40 / 42


Panel Data Linear Models Dynamic panel linear models Empirical example - Arellano-Bover/Blundell-Bond

Arellano-Bover/Blundell-Bond . xtdpdsys lconsumo lpib lirate ,lags(1) maxldep(4) vsquish System dynamic panel-data estimation Number of obs Group variable: country Number of groups Time variable: year Obs per group:

Number of instruments =

27

Wald chi2(3) Prob > chi2

= =

658 108

min = avg = max = = =

1 6.092593 7 16278.38 0.0000

One-step results lconsumo

Coef.

lconsumo L1. lpib lirate _cons

.3169481 .6010134 .0010375 1.834053

Std. Err.

.0290153 .0288126 .003142 .17602

z

10.92 20.86 0.33 10.42

P>|z|

0.000 0.000 0.741 0.000

[95% Conf. Interval]

.2600791 .5445417 -.0051206 1.48906

.373817 .6574852 .0071957 2.179046

Instruments for differenced equation GMM-type: L(2/5).lconsumo Standard: D.lpib D.lirate Instruments for level equation GMM-type: LD.lconsumo Standard: _cons Gustavo Sanchez (StataCorp)

June 22-23, 2012

41 / 42


Panel Data Linear Models Summary

Summary Brief introduction to panel data linear models Fitting the model in Stata Testing and accounting for serial correlation and heteroskedasticity Panel Unit root tests - Model in first differences Dynamic panel linear models

Gustavo Sanchez (StataCorp)

June 22-23, 2012

42 / 42


Panel Data Linear Models References

References Anderson and Hsiao 1981. Estimation of dynamic models with error components. Journal of the American Statistical Association 76:598—606 Arellano, M. and S. Bond. 1991. Some tests of specification for panel data: Monte Carlo evidence and an application to employment equations. The Review of Economic Studies 58: 277—297. Arellano, M. and O. Bover. 1995. Another look at the instrumental variable estimation of error-components models. Journal of Econometrics 68: 29—51. Blundell, R. and S. Bond. 1998. Initial conditions and moment restrictions in dynamic panel data models. Journal of Econometrics 87: 115—43. Drukker, D. M. 2003. Testing for serial correlation in linear panel-data models. Stata Journal 3: 168—177. Poi and Wiggins 2001. http://www.stata.com/support/faqs/stat/panel.html Wooldridge, J. M. 2002. Econometric Analysis of Cross Section and Panel Data. Cambridge, MA: MIT Press World Bank DataBank http://databank.worldbank.org/data/Home.aspx Gustavo Sanchez (StataCorp)

June 22-23, 2012

43 / 42


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.