**[XT] xtpcse** -- Linear regression with panel-corrected standard errors

__Syntax__

**xtpcse** *depvar* [*indepvars*] [*if*] [*in*] [*weight*] [**,** *options*]

*options* Description
-------------------------------------------------------------------------
Model
__nocons__**tant** suppress constant term
__c__**orrelation(**__i__**ndependent)** use independent autocorrelation structure
__c__**orrelation(**__a__**r1)** use AR1 autocorrelation structure
__c__**orrelation(**__p__**sar1)** use panel-specific AR1 autocorrelation
structure
__rho__**type(***calc***)** specify method to compute autocorrelation
parameter; seldom used
**np1** weight panel-specific autocorrelations by
panel sizes
__het__**only** assume panel-level heteroskedastic errors
__i__**ndependent** assume independent errors across panels

by/if/in
__ca__**sewise** include only observations with complete cases
__p__**airwise** include all available observations with
nonmissing pairs

SE
**nmk** normalize standard errors by N-k instead of N

Reporting
__l__**evel(***#***)** set confidence level; default is **level(95)**
__d__**etail** report list of gaps in time series
*display_options* control columns and column formats, row
spacing, line width, display of omitted
variables and base and empty cells, and
factor-variable labeling

__coefl__**egend** display legend instead of statistics
-------------------------------------------------------------------------
A panel variable and a time variable must be specified; use **xtset**.
*indepvars* may contain factor variables; see fvvarlist.
*depvar* and *indepvars* may contain time-series operators; see tsvarlist.
**by** and **statsby** are allowed; see prefix.
**iweight**s and **aweight**s are allowed; see weight.
**coeflegend** does not appear in the dialog box.
See **[XT] xtpcse postestimation** for features available after estimation.

__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

__reg__**ress** regression using lags; the default
**freg** regression using leads
__tsc__**orr** time-series autocorrelation calculation
**dw** Durbin-Watson calculation

All the above methods are consistent and asymptotically equivalent;
this is a rarely used option.

**np1** specifies that the panel-specific autocorrelations be weighted by T_i
rather than by the default T_i-1 when estimating a common rho for all
panels, where T_i 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.

+----------+
----+ 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 (2018, 313) 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*: **noci**, __nopv__**alues**, __noomit__**ted**, **vsquish**, __noempty__**cells**,
__base__**levels**, __allbase__**levels**, __nofvlab__**el**, **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**.

__Examples__

Setup
**. webuse grunfeld**
**. xtset company year, yearly**

Fit linear regression with panel-corrected standard errors, assuming no
autocorrelation within panels
**. xtpcse invest mvalue kstock**

Specify first-order autocorrelation within panels
**. xtpcse invest mvalue kstock, correlation(ar1)**

Specify panel-specific first-order autocorrelation; use time-series
method to estimate autocorrelation parameters
**. xtpcse invest mvalue kstock, correlation(psar1) rhotype(tscorr)**

Specify first-order autocorrelation within panels; allow panel-level
disturbances to be heteroskedastic but not contemporaneously correlated
**. xtpcse invest mvalue kstock, correlation(ar1) hetonly**

__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)** chi-squared
**e(p)** p-value for model test
**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)** rho
**e(cons)** **noconstant** or ""
**e(missmeth)** **casewise** or **pairwise**
**e(balance)** **balanced** or **unbalanced**
**e(chi2type)** **Wald**; type of model chi-squared 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(marginsnotok)** predictions disallowed by **margins**
**e(asbalanced)** factor variables **fvset** as **asbalanced**
**e(asobserved)** factor variables **fvset** as **asobserved**

Matrices
**e(b)** coefficient vector
**e(Sigma)** Sigma hat matrix
**e(rhomat)** vector of autocorrelation parameter estimates
**e(V)** variance-covariance matrix of the estimators

Functions
**e(sample)** marks estimation sample

__Reference__

Greene, W. H. 2018. *Econometric Analysis*. 8th ed. New York: Pearson.