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
xtivreg28 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
xtivreg28 [, first ffirst rf level(#) noheader nofooter eform(string) depname(varname) plus ]}
Version syntax
xtivreg28, version
xtivreg28 may be used with time-series or panel data, in which case the data can be tsset before using xtivreg28; 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 xtivreg28 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
xtivreg28 implements IV/GMM estimation of the fixed-effects and first-differences panel data models with possibly endogenous regressors. It is essentially a wrapper for ivreg28, which must be installed for xtivreg28 to run. xtivreg28 and ivreg28 will run under Stata 8; users with Stata 9 or later should use the more recent versions of these programs (xtivreg2, ivreg2, ivreg29, etc.).
xtivreg28 supports all the estimation and reporting options of ivreg28; see help ivreg28 for full descriptions and examples. In particular, all the statistics available with ivreg28 (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 xtivreg28 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, xtivreg28 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 xtivreg28 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 xtivreg28 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 xtivreg28 and differences vs. official xtivreg:
xtivreg28 supports only the fixed effects and the first-differences panel models; the option fe or fd is required. GLS random effects is not supported.
xtivreg28 does not estimate or report a constant with the fixed effects model fe.
First-differences estimation with xtivreg28 yields estimates identical to ivreg28 when the latter is supplied with all variables expressed in first-differences.
xtivreg28 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 xtivreg28 with the ivar option. For first-differences estimation, the data must be tsset.
xtivreg28 supports all types of weights.
The R-squared reported by xtivreg28 for the fixed-effects estimation is the "within R-squared" obtained by estimating the equation in mean-deviation form.
xtivreg28 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. xtivreg28, fixed effects)
. xtivreg28 ys k (n=l2.n l3.n), fe small
. xtivreg ys k (n=l2.n l3.n), fe small
(xtivreg28 vs. ivreg28 vs. xtivreg, first-differences)
. xtivreg28 ys k (n=l.n l2.n), fd small first
. ivreg28 d.ys d.k (d.n=ld.n ld2.n), small first
. xtivreg ys k (n=l.n l2.n), fd small
Citation of xtivreg28
xtivreg28 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., 2012. xtivreg28: 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, ivreg28, overid, ivendog, ivhettest, ivreset, xtoverid, condivreg (if installed)