*! version 1.0 Feb 2017
help xtcaec

Title

xtcaec -- Estimate heterogeneous error correction models in cross-sectional dependent panel data

Syntax

xtcaec depvar indepvars [if] [in] [, lags(num) select calags(num) cavars(varlist) noca trend det(varlist)
avlr mg lrplot(num) res(newvar) ]

xtcaec is for use with panel data. You must xtset your data before using xtcaec.

xtcaec requires xtcd2 and coefplot to be installed.

Description

xtcaec augments error correction models with cross-sectional averages of selected variables in order to eliminate the differential impacts of unobserved common factors. The routine
estimates individual error correction models for each panel member i and, then, calculates mean-group estimates of the error correction and the long-run coefficients. In addition, it
investigates whether the empirical model can remove cross-sectional dependence from the model residual.

Background:

Variable non-stationarity and cross-sectional dependence are two characteristics of panel data that have received attention in the macro-empirical literature.
While variable non-stationarity requires cointegration analysis, a common-correlated effects estimation (CCE) approach can concern cross-sectional dependence
(see Pesaran, 2006; Eberhardt and Teal, 2011, provide a helpful introduction to this topic).
The xtcaec command integrates both approaches in one framework.
It builds on the methodologies presented in Chudik and Pesaran (2015); Eberhadt and Presbitero (2015); and Gengenbach, Urbain, and Westerlund (2015).

Empirical Approach:

In a first step, xtcaec estimates the following error correction model for each panel member separately (here depicted for one x), where all variables in levels are assumed to
be I(1) and where ca() are the cross-sectional averages of the particular variables:

D.y_it = b0_i + b1_i1*y_it-1 + b2_i1*x_it-1 + a2_i0*D.x_it

+ a1_i1*D.y_it-1 + ... + a1_ip*D.y_it-p + a2_i1*D.x_it-1 + ... + a2_ip*D.x_it-p

+ b1_i2*ca(y_it-1) + b2_i2*ca(x_it-1)

+ c1_i1*D.ca(y_it-1) * ... + c1_ip*D.ca(y_it-p) + c2_i1*D.ca(x_it-1) + ... + c2_ip*D.ca(x_it-p)

+ e_it .

The mean-group coefficients of above model are calculated as unweighted means of the group-specific estimates. Their standard errors are derived non-parametrically following Pesaran and Smith (1995).

In a second step, xtcaec ananlyses the following:

1. Cointegration between the variables by investigating the EC-coefficients b1_i1. Specifically, it calculates

(a) the unweighted mean-group EC-coefficient as sum_i(b_1_i1) / N,

(b) the unweighted average t-statistic of the EC-coefficients across panel members,

(b) its corresponding p-value
that relates to the critical values presented in Gengenbach, Urbain, and Westerlund (2015);

2. The long-run coefficient of each x and its significance to be different from zero. Therefore, it computes

(a) the long-run average coefficient as -(sum_i(b2_i1)/sum_i(b1_i1)),

(b) its standard error, t-statistic, and p-value (by the Delta method using nlcom);

3. It applies the Pesaran (2015) test on cross-sectional dependence to

(a) the dependent and independent variables in order to demonstrate potential cross-sectional dependence in the untransformed variables,

(b) the model residuals in order to test whether the empirical model is powerful in resolving cross-sectional dependence.

Note

xtcaec calculates the cross-sectional averages over the whole sample that has been loaded into memory. Thus, cross-sectional averages are not affected by
[if] [in]. This allows to directly compare the results across subsets of groups. xtcaec requires a well prepared and adjusted data set.

Options

lags(# [#]) specifies the number of lagged first differences that are included in the error correction equation (default is 0). If one number is specified, it either determines the fixed number of lags or the upper lag limit
for the select option; a second (lower) number would determine the lower lag limit.

select enables automatic General-to-Specific lag selection that allows for heterogeneous lag orders: For each panel member i and each variable, the largest lag in first differences is dropped
from the regressions if it is insignificant (at the 10%-level); then, the regressions and the selection procedure are repeated. This option ensures that the largest lags of the variables in first differences are significant.
(This option refers only to the (untransformed) variables in first differences, not to the differenced cross-sectional averages that are specified in the calags(#) option.
Therefore, select should be combined with the lags(#) option.)

calags(#) specifies the number of lags of cross-sectional averages in first differences that are included in the estimations (default is 0).

cavars(varlist) , if enabled, allows to specify the variables that are included as cross-sectional averages. Default option is to use all variables from depvar and indepvars.

noca avoids including cross-sectional averages in the error correction model.

trend includes a (unrestricted) group-specific linear trend in the error correction model.

det(varlist) defines additional deterministics that are included in the error correction model.

avlr additionally displays the average long-run coefficient of each x that is calculated as sum_i(-b2_i1/b1_i1) (cf. Eberhardt and Presbitero, 2015). Note that the average long-run coefficient is very sensitive to positive
outliers in the group-specific EC-coefficients.

mg displays the mean-group error correction model.

lrplot(#) plots the group-specific long-run coefficients of the #th independent variable specified in indepvars. Look for outliers!

res(newvar) save residuals as a new variable.

Return values

Scalars

e(N) The number of observations.

e(ng) The number of groups.

e(rmse) The root mean square error.

Matrices

e(b) Matrix of mean-group coefficients.

e(V) Variance-covariance matrix of mean-group coefficients.

e(ib) Matrix of group-specific regression coefficients.

e(se_ib) Standard errors of group-specific coefficients.

e(t_ib) T-statistics of group-specific coefficients.

e(ilr) Matrix of group-specific long-run coefficients.

e(se_ilr) Standard errors of group-specific long-run coefficients.

e(t_ilr) T-statistics of group-specific long-run coefficients.

Example

Download the Westerlund (2007) data on GDP and health expenditures:

.use http://fmwww.bc.edu/repec/bocode/x/xtwestdata.dta.

xtset your data:

.xtset ctr year

Following Eberhardt and Presbitero (2015), apply an error correction representation of the Chudik and Pesaran (2015) dynamic CCE estimator. Include a fixed number of lagged differences of cross-sectional averages
according to [T^(1/3)]-1=2:

.xtcaec loghex loggdp, calags(2)

In order to account for potential short-run dynamics in the cointegrating relationship, allow for heterogeneous lag orders in the variable first differences by enabling lag selection:
Now, the t-bar statistic indicates cointegration at the 1%-level,
the long-run coefficient is still significant, and the estimation residuals are cross-sectional
independent:

.xtcaec loghex loggdp, calags(2) lags(3) select

Take a look at the group-specific coefficient matrix to grasp the results of the lag selection procedure:

.mat list e(ib)

Plot the individual-specific long-run coefficients and display the average long-run coefficient:

.xtcaec loghex loggdp, calags(2) lags(3) select avlr lrplot(1)

References and related studies

Campos, Ericsson, and Hendry (2005) 'General-to-specific modeling: an overview and selected bibliography,' FRB International Finance Discussion Paper No. 838

Chudik and Pesaran (2015) 'Common correlated effects estimation of heterogeneous dynamic panel data models with weakly exogenous regressors,' Journal of Econometrics

Eberhardt (2012) 'Estimating panel time-series models with heterogeneous slopes,' The Stata Journal 12

Eberhardt and Teal (2011) 'Econometrics For Grumblers: A New Look At The Literature On Cross-Country Growth Empirics,' Journal of Economic Surveys

Eberhardt and Presbitero (2015) 'Public debt and growth: Heterogeneity and non-linearity,' Journal of International Economics

Gengenbach, Urbain, and Westerlund (2015) 'Error correction testing in panels with global stochastic trends,' Journal of Applied Econometrics

Jann (2013) 'Coefplot: Stata module to plot regression coefficients and other results.' University of Bern Social Sciences Working Papers Nr. 1.

Persyn and Westerlund (2008) 'Error correction based cointegration tests for panel data,' The Stata Journal 8

Pesaran (2006) 'Estimation and Inference in Large Heterogeneous Panels with a Multifactor Error Structure,' Econometrica

Pesaran and Smith (1995) 'Estimating long-run relationships from dynamic heterogeneous panels,' Journal of Econometrics

Pesaran (2015) 'Testing weak cross-sectional dependence in large panels,' Econometric Reviews

Ver Hoef (2012) 'Who invented the delta method?,' The American Statistician 66

Westerlund (2007) 'Testing for Error Correction in Panel Data,' Oxford Bulletin of Economics and Statistics 69

Acknowledgements

xtcaec implements empirical frameworks that are proposed in the existing literature. Any errors are of course my own.
The code of this routine is inspired by the xtmg command written by Markus Eberhardt and the xtwest command written by Damiaan Persyn and Joakim Westerlund. Many thanks to Kit Baum!

Author

Korbinian Nagel
Helmut Schmidt University Hamburg
xtcaec@korbinian-nagel.de
korbinian.nagel@hsu-hh.de