**[XT] xt** -- Introduction to xt commands

__Description__

The xt series of commands provide tools for analyzing panel data (also
known as longitudinal data or in some disciplines as cross-sectional time
series when there is an explicit time component). Panel datasets have
the form **x**_[it], where **x**_[it] is a vector of observations for unit i and
time t. The particular commands (such as **xtdescribe**, **xtsum**, and **xtreg**)
are documented in alphabetical order in the entries that follow this
entry. If you do not know the name of the command you need, try browsing
the second part of this description section, which organizes the xt
commands by topic. *Remarks and examples* of **[XT] xt** describes concepts
that are common across commands.

The **xtset** command sets the panel variable and the time variable; see **[XT]**
**xtset**. Most xt commands require that the panel variable be specified,
and some require that the time variable also be specified. Once you
**xtset** your data, you need not do it again. The **xtset** information is
stored with your data.

If you have previously **tsset** your data by using both a panel and a time
variable, these settings will be recognized by **xtset**, and you need not
**xtset** your data.

If your interest is in general time-series analysis, see **[U] 26.13**
**Time-series models** and the *Time-Series Reference Manual*. If your
interest is in multilevel mixed-effects models, see the *Multilevel*
*Mixed-Effects Reference Manual*. If you are interested in SAR (spatial
autoregressive or simultaneously autoregressive) models for panel data,
see **[SP] spxtregress**.

__Setup__

**xtset** Declare data to be panel data

__Data management and exploration tools__

**xtdescribe** Describe pattern of xt data
**xtsum** Summarize xt data
**xttab** Tabulate xt data
**xtdata** Faster specification searches with xt data
**xtline** Panel-data line plots

__Linear regression estimators__

**xtreg** Fixed-, between-, and random-effects, and
population-averaged linear models
**xtregar** Fixed- and random-effects linear models with an AR(1)
disturbance
**xtgls** Fit panel-data models using GLS
**xtpcse** Linear regression with panel-corrected standard errors
**xthtaylor** Hausman-Taylor estimator for error-components models
**xtfrontier** Stochastic frontier models for panel data
**xtrc** Random-coefficients model
**xtivreg** Instrumental variables and two-stage least squares for
panel-data models

__Unit-root tests__

**xtunitroot** Panel-data unit-root tests

__Cointegration tests__

**xtcointtest** Panel-data cointegration tests

__Dynamic panel-data estimators__

**xtabond** Arellano-Bond linear dynamic panel-data estimation
**xtdpd** Linear dynamic panel-data estimation
**xtdpdsys** Arellano-Bover/Blundell-Bond linear dynamic panel-data
estimation

__Censored-outcome estimators__

**xttobit** Random-effects tobit models
**xtintreg** Random-effects interval-data regression models

__Binary-outcome estimators__

**xtlogit** Fixed-effects, random-effects, and population-averaged
logit models
**xtprobit** Random-effects and population-averaged probit models
**xtcloglog** Random-effects and population-averaged cloglog models

__Ordinal-outcome estimators__

**xtologit** Random-effects ordered logistic models
**xtoprobit** Random-effects ordered probit models

__Count-data estimators__

**xtpoisson** Fixed-effects, random-effects, and population-averaged
Poisson models
**xtnbreg** Fixed-effects, random-effects, & population-averaged
negative binomial models

__Survival-time estimators__

**xtstreg** Random-effects parametric survival models

__Generalized estimating equations estimator__

**xtgee** Population-averaged panel-data models using GEE

__Utilities__

**quadchk** Check sensitivity of quadrature approximation

__Example__

An xt dataset:

pid yr_visit fev age sex height smokes
----------------------------------------------
1071 1991 1.21 25 1 69 0
1071 1992 1.52 26 1 69 0
1071 1993 1.32 28 1 68 0
1072 1991 1.33 18 1 71 1
1072 1992 1.18 20 1 71 1
1072 1993 1.19 21 1 71 0

The other xt commands need to know the identities of the variables
identifying patient and time. You could type

**. xtset pid yr_visit**