**[XT] xtregar** -- Fixed- and random-effects linear models with an AR(1)
disturbance

__Syntax__

GLS random-effects (RE) model

**xtregar** *depvar* [*indepvars*] [*if*] [*in*] [**, re** *options*]

Fixed-effects (FE) model

**xtregar** *depvar* [*indepvars*] [*if*] [*in*] [*weight*] **, fe** [*options*]

*options* Description
-------------------------------------------------------------------------
Model
**re** use random-effects estimator; the default
**fe** use fixed-effects estimator
__rhot__**ype(***rhomethod***)** specify method to compute autocorrelation; seldom
used
**rhof(***#***)** use # for p and do not estimate p
__two__**step** perform two-step estimate of correlation

Reporting
__l__**evel(***#***)** set confidence level; default is **level(95)**
**lbi** perform Baltagi-Wu LBI test
*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.
**fweight**s and **aweight**s are allowed for the fixed-effects model with
**rhotype(regress)** or **rhotype(freg)**, or with a fixed rho; see weight.
Weights must be constant within panel.
**coeflegend** does not appear in the dialog box.
See **[XT] xtregar postestimation** for features available after estimation.

__Menu__

**Statistics > Longitudinal/panel data > Linear models >** **Linear regression**
**with AR(1) disturbance (FE, RE)**

__Description__

**xtregar** fits cross-sectional time-series regression models when the
disturbance term is first-order autoregressive. **xtregar** offers a within
estimator for fixed-effects models and a GLS estimator for random-effects
models. **xtregar** can accommodate unbalanced panels whose observations are
unequally spaced over time.

__Options__

**re** requests the GLS estimator of the random-effects model, which is the
default.

**fe** requests the within estimator of the fixed-effects model.

**rhotype(***rhomethod***)** allows the user to specify any of the following
estimators of rho:

**dw** rho_dw = 1 - d/2, where d is the Durbin-Watson d
statistic
__reg__**ress** rho_reg = B from the residual regression e_t =
B*e_(t-1)
**freg** rho_freg = B from the residual regression e_t =
B*e_(t+1)
__tsc__**orr** rho_tscorr = e'e_(t-1)/e'e, where e is the vector of
residuals and e_(t-1) is the vector of lagged
residuals
__th__**eil** rho_theil = rho_tscorr * (N-k)/N
__nag__**ar** rho_nagar = (rho_dw * N*N+k*k)/(N*N-k*k)
__one__**step** rho_onestep = (n/m_c)*rho_tscorr, where n is the
number of observations and m_c is the number of
consecutive pairs of residuals

**dw** is the default method. Except for **onestep**, the details of these
methods are given in **[TS] prais**. **prais** handles unequally spaced
data. **onestep** is the one-step method proposed by Baltagi and Wu
(1999). More details on this method are available in *Methods and*
*formulas* of **[XT] xtregar**.

**rhof(***#***)** specifies that the given number be used for rho and that rho not
be estimated.

**twostep** requests that a two-step implementation of the *rhomethod*
estimator of rho be used. Unless a fixed value of rho is specified
(with the **rhof()** option), rho is estimated by running **prais** on the
de-meaned data. When **twostep** is specified, **prais** will stop on the
first iteration after the equation is transformed by rho -- the
two-step efficient estimator. Although it is customary to iterate
these estimators to convergence, they are efficient at each step.
When **twostep** is not specified, the FGLS process iterates to
convergence as described in the *Methods and formulas* of **[TS] prais**.

+-----------+
----+ Reporting +--------------------------------------------------------

**level(***#***)**; see **[R] estimation options**.

**lbi** requests that the Baltagi-Wu (1999) locally best invariant (LBI) test
statistic that rho = 0 and a modified version of the Bhargava,
Franzini, and Narendranathan (1982) Durbin-Watson statistic be
calculated and reported. The default is not to report them.
p-values are not reported for either statistic. Although Bhargava,
Franzini, and Narendranathan (1982) published critical values for
their statistic, no tables are currently available for the Baltagi-Wu
LBI. Baltagi and Wu (1999) derive a normalized version of their
statistic, but this statistic cannot be computed for datasets of
moderate size. You can also specify these options upon reply.

*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 **xtregar** but is not shown in the
dialog box:

**coeflegend**; see **[R] estimation options**.

__Examples__

Setup
**. webuse grunfeld**
**. xtset company time**

Random-effects model
**. xtregar invest mvalue kstock**

Fixed-effects model
**. xtregar invest mvalue kstock, fe**

Random-effects model and report Baltagi-Wu LBI test
**. xtregar invest mvalue kstock, re lbi**

Fixed-effects model and perform two-step estimate of correlation
**. xtregar invest mvalue kstock, fe twostep**

__Stored results__

**xtregar, re** stores the following in **e()**:

Scalars
**e(N)** number of observations
**e(N_g)** number of groups
**e(df_m)** model degrees of freedom
**e(g_min)** smallest group size
**e(g_avg)** average group size
**e(g_max)** largest group size
**e(d1)** Bhargava et al. Durbin-Watson
**e(LBI)** Baltagi-Wu LBI statistic
**e(N_LBI)** number of obs used in **e(LBI)**
**e(Tcon)** **1** if T is constant
**e(sigma_u)** panel-level standard deviation
**e(sigma_e)** standard deviation of z_it
**e(r2_w)** R-squared within model
**e(r2_o)** R-squared overall model
**e(r2_b)** R-squared between model
**e(chi2)** chi-squared
**e(rho_ar)** autocorrelation coefficient
**e(rho_fov)** u_i fraction of variance
**e(thta_min)** minimum theta
**e(thta_5)** theta, 5th percentile
**e(thta_50)** theta, 50th percentile
**e(thta_95)** theta, 95th percentile
**e(thta_max)** maximum theta
**e(Tbar)** harmonic mean of group sizes
**e(rank)** rank of **e(V)**

Macros
**e(cmd)** **xtregar**
**e(cmdline)** command as typed
**e(depvar)** name of dependent variable
**e(ivar)** variable denoting groups
**e(tvar)** variable denoting time within groups
**e(model)** **re**
**e(rhotype)** method of estimating rho_ar
**e(dw)** **lbi**, if **lbi** specified
**e(chi2type)** **Wald**; type of model chi-squared test
**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(V)** VCE for random-effects model

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

**xtregar, fe** stores the following in **e()**:

Scalars
**e(N)** number of observations
**e(N_g)** number of groups
**e(df_m)** model degrees of freedom
**e(mss)** model sum of squares
**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(d1)** Bhargava et al. Durbin-Watson
**e(LBI)** Baltagi-Wu LBI statistic
**e(N_LBI)** number of obs used in **e(LBI)**
**e(Tcon)** **1** if T is constant
**e(corr)** corr(u_i, Xb)
**e(sigma_u)** panel-level standard deviation
**e(sigma_e)** standard deviation of epsilon_it
**e(r2_a)** adjusted R-squared
**e(r2_w)** R-squared within model
**e(r2_o)** R-squared overall model
**e(r2_b)** R-squared between model
**e(ll)** log likelihood
**e(ll_0)** log likelihood, constant-only model
**e(rho_ar)** autocorrelation coefficient
**e(rho_fov)** u_i fraction of variance
**e(F)** F statistic
**e(F_f)** F for u_i=0
**e(df_r)** residual degrees of freedom
**e(df_a)** degrees of freedom for absorbed effect
**e(df_b)** numerator degrees of freedom for F statistic
**e(rmse)** root mean squared error
**e(Tbar)** harmonic mean of group sizes
**e(rank)** rank of **e(V)**

Macros
**e(cmd)** **xtregar**
**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(model)** **fe**
**e(rhotype)** method of estimating rho_ar
**e(dw)** **lbi**, if **lbi** specified
**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(V)** variance-covariance matrix of the estimators

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

__References__

Baltagi, B. H., and P. X. Wu. 1999. Unequally spaced panel data
regressions with AR(1) disturbances. *Econometric Theory* 15: 814-823.

Bhargava, A., L. Franzini, and W. Narendranathan. 1982. Serial
correlation and the fixed effects model. *Review of Economic Studies*
49: 533-549.