Xtxtpcse
Xtxtpcse
com
xtpcse — Linear regression with panel-corrected standard errors
Syntax
xtpcse depvar indepvars if in weight , options
options Description
Model
noconstant suppress constant term
correlation(independent) use independent autocorrelation structure
correlation(ar1) use AR1 autocorrelation structure
correlation(psar1) use panel-specific AR1 autocorrelation structure
rhotype(calc) specify method to compute autocorrelation parameter;
seldom used
np1 weight panel-specific autocorrelations by panel sizes
hetonly assume panel-level heteroskedastic errors
independent assume independent errors across panels
by/if/in
casewise include only observations with complete cases
pairwise include all available observations with nonmissing pairs
SE
nmk normalize standard errors by N − k instead of N
Reporting
level(#) set confidence level; default is level(95)
detail report list of gaps in time series
display options control column formats, row spacing, line width, display of omitted
variables and base and empty cells, and factor-variable labeling
coeflegend display legend instead of statistics
A panel variable and a time variable must be specified; use xtset; see [XT] xtset.
indepvars may contain factor variables; see [U] 11.4.3 Factor variables.
depvar and indepvars may contain time-series operators; see [U] 11.4.4 Time-series varlists.
by and statsby are allowed; see [U] 11.1.10 Prefix commands.
iweights and aweights are allowed; see [U] 11.1.6 weight.
coeflegend does not appear in the dialog box.
See [U] 20 Estimation and postestimation commands for more capabilities of estimation commands.
1
2 xtpcse — Linear regression with panel-corrected standard errors
Menu
Statistics > Longitudinal/panel data > Contemporaneous correlation > Regression with panel-corrected standard
errors (PCSE)
Description
xtpcse calculates panel-corrected standard error (PCSE) estimates for linear cross-sectional time-
series models where the parameters are estimated by either OLS or Prais–Winsten regression. When
computing the standard errors and the variance–covariance estimates, xtpcse assumes that the
disturbances are, by default, heteroskedastic and contemporaneously correlated across panels.
See [XT] xtgls for the generalized least-squares estimator for these models.
Options
Model
noconstant; see [R] estimation options.
correlation(corr) specifies the form of assumed autocorrelation within panels.
correlation(independent), the default, specifies that there is no autocorrelation.
correlation(ar1) specifies that, within panels, there is first-order autocorrelation AR(1) and
that the coefficient of the AR(1) process is common to all the panels.
correlation(psar1) specifies that, within panels, there is first-order autocorrelation and that the
coefficient of the AR(1) process is specific to each panel. psar1 stands for panel-specific AR(1).
rhotype(calc) specifies the method to be used to calculate the autocorrelation parameter. Allowed
strings for calc are
regress regression using lags; the default
freg regression using leads
tscorr time-series autocorrelation calculation
dw Durbin–Watson calculation
All above methods are consistent and asymptotically equivalent; this is a rarely used option.
np1 specifies that the panel-specific autocorrelations be weighted by Ti rather than by the default
Ti − 1 when estimating a common ρ for all panels, where Ti is the number of observations in
panel i. This option has an effect only when panels are unbalanced and the correlation(ar1)
option is specified.
hetonly and independent specify alternative forms for the assumed covariance of the disturbances
across the panels. If neither is specified, the disturbances are assumed to be heteroskedastic (each
panel has its own variance) and contemporaneously correlated across the panels (each pair of
panels has its own covariance). This is the standard PCSE model.
hetonly specifies that the disturbances are assumed to be panel-level heteroskedastic only with
no contemporaneous correlation across panels.
independent specifies that the disturbances are assumed to be independent across panels; that
is, there is one disturbance variance common to all observations.
xtpcse — Linear regression with panel-corrected standard errors 3
by/if/in
casewise and pairwise specify how missing observations in unbalanced panels are to be treated
when estimating the interpanel covariance matrix of the disturbances. The default is casewise
selection.
casewise specifies that the entire covariance matrix be computed only on the observations (periods)
that are available for all panels. If an observation has missing data, all observations of that period
are excluded when estimating the covariance matrix of disturbances. Specifying casewise ensures
that the estimated covariance matrix will be of full rank and will be positive definite.
pairwise specifies that, for each element in the covariance matrix, all available observations
(periods) that are common to the two panels contributing to the covariance be used to compute
the covariance.
The casewise and pairwise options have an effect only when the panels are unbalanced and
neither hetonly nor independent is specified.
SE
nmk specifies that standard errors be normalized by N − k , where k is the number of parameters
estimated, rather than N , the number of observations. Different authors have used one or the other
normalization. Greene (2012, 280) remarks that whether a degree-of-freedom correction improves
the small-sample properties is an open question.
Reporting
level(#); see [R] estimation options.
detail specifies that a detailed list of any gaps in the series be reported.
display options: noomitted, vsquish, noemptycells, baselevels, allbaselevels, nofvla-
bel, fvwrap(#), fvwrapon(style), cformat(% fmt), pformat(% fmt), sformat(% fmt), and
nolstretch; see [R] estimation options.
The following option is available with xtpcse but is not shown in the dialog box:
coeflegend; see [R] estimation options.
y1 X1 1
y 2 X2
. = . β + .2
. .. ..
.
ym Xm m
For a model with heteroskedastic disturbances and contemporaneous correlation but with no autocor-
relation, the disturbance covariance matrix is assumed to be
where σii is the variance of the disturbances for panel i, σij is the covariance of the disturbances
between panel i and panel j when the panels’ periods are matched, and I is a Ti by Ti identity
matrix with balanced panels. The panels need not be balanced for xtpcse, but the expression for the
covariance of the disturbances will be more general if they are unbalanced.
This could also be written as
Although xtpcse allows other disturbance covariance structures, the term PCSE, as used in the
literature, refers specifically to models that are both heteroskedastic and contemporaneously correlated
across panels, with or without autocorrelation.
To compute PCSEs, Stata must be able to identify the panel to which each observation belongs and
be able to match the periods across the panels. We tell Stata how to do this matching by specifying
the panel and time variables with xtset; see [XT] xtset. Because the data are annual, we specify the
yearly option.
. xtset company year, yearly
panel variable: company (strongly balanced)
time variable: year, 1935 to 1954
delta: 1 year
We can obtain OLS parameter estimates for a linear model of invest on mvalue and kstock
while allowing the standard errors (and variance–covariance matrix of the estimates) to be consistent
when the disturbances from each observation are not independent. Specifically, we want the standard
errors to be robust to each company having a different variance of the disturbances and to each
company’s observations being correlated with those of the other companies through time.
6 xtpcse — Linear regression with panel-corrected standard errors
Panel-corrected
invest Coef. Std. Err. z P>|z| [95% Conf. Interval]
The coefficients between the two models are close; the constants differ substantially, but we are
generally not interested in the constant. As Beck and Katz observed, the standard errors for the FGLS
model are 50%–100% smaller than those for the OLS model with PCSE.
If we were also concerned about autocorrelation of the disturbances, we could obtain a model with
a common AR(1) parameter by specifying correlation(ar1).
xtpcse — Linear regression with panel-corrected standard errors 7
Panel-corrected
invest Coef. Std. Err. z P>|z| [95% Conf. Interval]
rho .9059774
The estimate of the autocorrelation parameter is high (0.906), and the standard errors are larger
than for the model without autocorrelation, which is to be expected if there is autocorrelation.
Panel-corrected
invest Coef. Std. Err. z P>|z| [95% Conf. Interval]
Beck and Katz (1995, 121) make a case against estimating panel-specific AR parameters, as opposed
to one AR parameter for all panels.
8 xtpcse — Linear regression with panel-corrected standard errors
Het-corrected
invest Coef. Std. Err. z P>|z| [95% Conf. Interval]
rho .9059774
With this specification, we do not obtain what are referred to in the literature as PCSEs. These
standard errors are in the same spirit as PCSEs but are from the asymptotic covariance estimates of
OLS without allowing for contemporaneous correlation.
xtpcse — Linear regression with panel-corrected standard errors 9
Stored results
xtpcse stores the following in e():
Scalars
e(N) number of observations
e(N g) number of groups
e(N gaps) number of gaps
e(n cf) number of estimated coefficients
e(n cv) number of estimated covariances
e(n cr) number of estimated correlations
e(n sigma) observations used to estimate elements of Sigma
e(mss) model sum of squares
e(df) degrees of freedom
e(df m) model degrees of freedom
e(rss) residual sum of squares
e(g min) smallest group size
e(g avg) average group size
e(g max) largest group size
e(r2) R-squared
e(chi2) χ2
e(p) significance
e(rmse) root mean squared error
e(rank) rank of e(V)
e(rc) return code
Macros
e(cmd) xtpcse
e(cmdline) command as typed
e(depvar) name of dependent variable
e(ivar) variable denoting groups
e(tvar) variable denoting time within groups
e(wtype) weight type
e(wexp) weight expression
e(title) title in estimation output
e(panels) contemporaneous covariance structure
e(corr) correlation structure
e(rhotype) type of estimated correlation
e(rho) ρ
e(cons) noconstant or ""
e(missmeth) casewise or pairwise
e(balance) balanced or unbalanced
e(chi2type) Wald; type of model χ2 test
e(vcetype) title used to label Std. Err.
e(properties) b V
e(predict) program used to implement predict
e(marginsok) predictions allowed by margins
e(asbalanced) factor variables fvset as asbalanced
e(asobserved) factor variables fvset as asobserved
Matrices
e(b) coefficient vector
e(Sigma) Σ
b matrix
e(rhomat) vector of autocorrelation parameter estimates
e(V) variance–covariance matrix of the estimators
Functions
e(sample) marks estimation sample
10 xtpcse — Linear regression with panel-corrected standard errors
ρ1 + ρ2 + · · · + ρm
ρ=
m
where ρi is the estimated autocorrelation coefficient for panel i and m is the number of panels.
The covariance of the OLS or Prais–Winsten coefficients is
where Σ is the m by m panel-by-panel covariance matrix of the disturbances; see Remarks and
examples.
xtpcse estimates the elements of Σ as
0
b ij = i j
Σ
Tij
where i and j are the residuals for panels i and j , respectively, that can be matched by period, and
where Tij is the number of residuals between the panels i and j that can be matched by time period.
When the panels are balanced (each panel has the same number of observations and all periods
are common to all panels), Tij = T , where T is the number of observations per panel.
When panels are unbalanced, xtpcse by default uses casewise selection, in which only those
residuals from periods that are common to all panels are used to compute Sbij . Here Tij = T ∗ ,
where T ∗ is the number of periods common to all panels. When pairwise is specified, each Sbij is
computed using all observations that can be matched by period between the panels i and j .
Acknowledgments
We thank the following people for helpful comments: Nathaniel Beck of the Department of
Politics at New York University, Jonathan Katz of the Division of the Humanities and Social Science
at California Institute of Technology, and Robert John Franzese Jr. of the Center for Political Studies
at the Institute for Social Research at the University of Michigan.
xtpcse — Linear regression with panel-corrected standard errors 11
References
Beck, N. L., and J. N. Katz. 1995. What to do (and not to do) with time-series cross-section data. American Political
Science Review 89: 634–647.
Blackwell, J. L., III. 2005. Estimation and testing of fixed-effect panel-data systems. Stata Journal 5: 202–207.
Davidson, R., and J. G. MacKinnon. 1993. Estimation and Inference in Econometrics. New York: Oxford University
Press.
Greene, W. H. 2012. Econometric Analysis. 7th ed. Upper Saddle River, NJ: Prentice Hall.
Grunfeld, Y., and Z. Griliches. 1960. Is aggregation necessarily bad? Review of Economics and Statistics 42: 1–13.
Hoechle, D. 2007. Robust standard errors for panel regressions with cross-sectional dependence. Stata Journal 7:
281–312.
Judge, G. G., W. E. Griffiths, R. C. Hill, H. Lütkepohl, and T.-C. Lee. 1985. The Theory and Practice of Econometrics.
2nd ed. New York: Wiley.
Kmenta, J. 1997. Elements of Econometrics. 2nd ed. Ann Arbor: University of Michigan Press.
Also see
[XT] xtpcse postestimation — Postestimation tools for xtpcse
[XT] xtset — Declare data to be panel data
[XT] xtgls — Fit panel-data models by using GLS
[XT] xtreg — Fixed-, between-, and random-effects and population-averaged linear models
[XT] xtregar — Fixed- and random-effects linear models with an AR(1) disturbance
[R] regress — Linear regression
[TS] newey — Regression with Newey–West standard errors
[TS] prais — Prais – Winsten and Cochrane – Orcutt regression
[U] 20 Estimation and postestimation commands