-------------------------------------------------------------------------------
help for xtivreg2
-------------------------------------------------------------------------------

Extended IV/2SLS, GMM and AC/HAC, LIML and k-class regression for panel data mo > dels

Full syntax, fixed effects and first differences models

xtivreg2 depvar [varlist1] (varlist2=varlist_iv) [weight] [if exp] [in range] , {fe | fd} [ivar(varname) tvar(varname) gmm bw(#) kernel(string) liml fuller(#) kclass(#) coviv cue cueinit(matrix) cueoptions(string) robust cluster(varlist) orthog(varlist_ex) endog(varlist_en) redundant(varlist_ex) fwl(varlist) small noconstant first ffirst savefirst savefprefix(prefix) rf saverf saverfprefix(prefix) nocollin noid level(#) noheader nofooter eform(string) depname(varname) plus ]

Replay syntax

xtivreg2 [, first ffirst rf level(#) noheader nofooter eform(string) depname(varname) plus ]}

Version syntax

xtivreg2, version

xtivreg2 may be used with time-series or panel data, in which case the data can be tsset before using xtivreg2; see help tsset.

All varlists may contain time-series operators; see help varlist.

aweights, fweights, iweights and pweights are allowed; see help weights.

The syntax of predict following xtivreg2 is

predict [type] newvarname [if exp] [in range] [, statistic]

For the fixed-effects estimator, statistic is

e v_it, the idiosyncratic component of the error term

and is available only for the estimation sample.

For the first-differences estimator, statistic is

e v_it - v_it-1, the first-differenced idiosyncratic component xb (X_it - X_it-1)*b_hat, the fitted values

and are available in and out of sample. Use e(sample) if wanted only for the estimation sample.

Description

xtivreg2 implements IV/GMM estimation of the fixed-effects and first-differences panel data models with possibly endogenous regressors. It is essentially a wrapper for ivreg2, which must be installed for xtivreg2 to run (version 2.1.11 or above of ivreg2 is required for Stata 9; Stata 8.2 requires ivreg28). xtivreg2 supports all the estimation and reporting options of ivreg2; see help ivreg2 for full descriptions and examples. In particular, all the statistics available with ivreg2 (heteroskedastic, cluster- and autocorrelation-robust covariance matrix and standard errors, overidentification and orthogonality tests, first-stage and weak/underidentification statistics, etc.) are also supported by xtivreg2 and will be reported with any degrees-of-freedom adjustments required for a panel data estimation.

The degrees-of-freedom adjustments depend on whether the estimation is fixed-effects or first-differences, and whether it uses the cluster option.

For fixed-effects estimation without cluster, the covariance matrix and regression statistics (identification and overidentification statistics, first-stage regressions and tests, etc.) are adjusted for the number of fixed effects N_g. With large-sample statistics, the covariance matrix has the adjustment (N-N_g); with small-sample statistics, the adjustment is (N-N_g-K), where K is the number of regressors.

For fixed-effects estimation with cluster, xtivreg2 makes no degrees-of-freedom adjustment for the number of fixed effects. This follows the formulation of a cluster-robust covariance matrix for the fixed-effects model as originally proposed by Arellano (1987); see, e.g., Wooldridge (2002), p. 275. Stata's official xtivreg, xtreg and areg (as of version 9.1, October 2005), by contrast, use the (N-N_g-K) adjustment, which is somewhat conservative in this context. However, the approach used by xtivreg2 requires that no panel overlaps more than one cluster. That is, either the panel variable is identical to the cluster variable, or panels are uniquely assigned to clusters. If any panel is contained in more than one cluster, the xtivreg2 approach is invalid, and it will exit with an error.

First-differences estimation makes no degrees-of-freedom adjustment, irrespective of whether cluster is used.

Other features of xtivreg2 and differences vs. official xtivreg:

xtivreg2 supports only the fixed effects and the first-differences panel models; the option fe or fd is required. GLS random effects is not supported.

xtivreg2 does not estimate or report a constant with the fixed effects model fe.

If ivreg2 version 3.0 or later is installed, xtivreg2 supports 2-way clustering; see help ivreg2 for details.

First-differences estimation with xtivreg2 yields estimates identical to ivreg2 when the latter is supplied with all variables expressed in first-differences.

xtivreg2 allows use of time series operators.

For fixed-effects estimation, the data must either be tsset, the panel id variable set with iis, or the panel id variable supplied to xtivreg2 with the ivar option. For first-differences estimation, the data must be tsset.

xtivreg2 supports all types of weights.

The R-squared reported by xtivreg2 for the fixed-effects estimation is the "within R-squared" obtained by estimating the equation in mean-deviation form.

xtivreg2 supports simple fixed effects and first-differences estimation with no endogeneous variables, i.e., (varlist2=varlist_iv) can be omitted.

Examples

. use http://fmwww.bc.edu/ec-p/data/macro/abdata.dta (Layard & Nickell, Unemployment in Britain, Economica 53, 1986, from Ox dist)

. tsset id year

(xtivreg vs. xtivreg2, fixed effects)

. xtivreg2 ys k (n=l2.n l3.n), fe small

. xtivreg ys k (n=l2.n l3.n), fe small

(xtivreg2 vs. ivreg2 vs. xtivreg, first-differences)

. xtivreg2 ys k (n=l.n l2.n), fd small first

. ivreg2 d.ys d.k (d.n=ld.n ld2.n), small first

. xtivreg ys k (n=l.n l2.n), fd small

Citation of xtivreg2

xtivreg2 is not an official Stata command. It is a free contribution to the research community, like a paper. Please cite it as such:

Schaffer, M.E., 2010. xtivreg2: Stata module to perform extended IV/2SLS, GMM and AC/HAC, LIML and k-class regression for panel data models. http://ideas.repec.org/c/boc/bocode/s456501.html

References

Arellano, M. 1987. Computing Robust Standard Errors for Within-Groups Estimators. Oxford Bulletin of Economics and Statistics, Vol. 49, pp. 431-34.

Baum, C.F., Schaffer, M.E., and Stillman, S. 2003. Instrumental Variables and GMM: Estimation and Testing. The Stata Journal, Vol. 3, No. 1, pp. 1-31. Unpublished working paper version: Boston College Department of Economics Working Paper No 545. http://fmwww.bc.edu/ec-p/WP545.pdf

Wooldridge, J.M. 2002. Econometric Analysis of Cross Section and Panel Data. Cambridge, MA: MIT Press.

Author

Mark E Schaffer, Heriot-Watt University, UK m.e.schaffer@hw.ac.uk

Also see

On-line: help for ivreg2, overid, ivendog, ivhettest, ivreset, xtoverid, condivreg (if installed)