rictan 发表于 2013-9-30 10:42 
xtivreg,ivreg2好像也可以做,两者有什么区别呢?
xtivreg2 vs ivreg2
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.
xtivreg2 vs xtivreg
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.
自己看xtivreg2的帮助文件更全面