Stata software for econometric estimation and testing; avar, weakiv, actest, ivreg2h, ranktest, ivreg2

Mark Edwin Schaffer (Developer), Christopher Baum (Developer), Keith Finlay (Developer), Frank Kleibergen (Developer), Leandro Magnusson (Developer), Steven Stillman (Developer)

Research output: Non-textual formSoftware

1866 Downloads (Pure)


The programs implement a range of advanced econometric estimation and testing procedures for use in the Stata statistical software environment. In all cases a wide range of variance-covariance estimators (VCEs) are supported, including heteroskedastic-, autocorrelation-, and heteroskedastic-and-autocorrelation-robust (HC, AC and HAC), cluster-robust, 2-way clustering, Kiefer and Driscoll-Kraay VCEs, etc. Panel data are also supported in all cases. (1) avar} is a routine for estimating S, the asymptotic variance of (1/N)*Z'e, where Z is an NxL matrix of L variables, e is an Nxp matrix of p variables, and N is the sample size. avar can estimate VCEs for single and multiple equations that are robust to various violations of the assumption of iid data, including heteroskedasticity, autocorrelation, 1- and 2-way clustering, kernel-robust common cross-panel disturbances (Driscoll-Kraay), within-panel arbitrary autocorrelation (Kiefer), etc. It supports time-series and panel data. It provides a front-end to the Mata routines shared by the software below. (2) weakiv calculates weak-instrument-robust tests of the coefficient on the endogenous variable in an IV estimation of linear, probit and tobit models. weakiv reports the Anderson-Rubin (AR) test statistic, the conditional likelihood ratio (CLR) test, the Lagrange multiplier K test, the J overidentification test, and a combination of the K and overidentification tests (the K-J test). weakiv also inverts these tests to construct confidence intervals that are robust to weak identification. weakiv provides a graphing facility for visual examination and presentation of rejection frequencies and confidence intervals based on these tests. (3) actest performs the general specification test of serial correlation in a time series proposed by Cumby and Huizinga. It can be applied to a univariate time series or as a postestimation command after OLS or instrumental variables (IV) estimation. The null hypothesis of the test is that the time series is a moving average of known order q, which could be zero or a positive value. The test considers the general alternative that autocorrelations of the time series are nonzero at lags greater than q. (4) ivreg2h estimates an IV regression model providing the option to generate instruments using Lewbel's method. This technique allows the identification of structural parameters in regression models with endogenous or mismeasured regressors in the absence of traditional identifying information, such as external instruments or repeated measurements. Identification is achieved in this context by having regressors that are uncorrelated with the product of heteroskedastic errors, which is a feature of many models where error correlations are due to an unobserved common factor. This approach may thus be applied when no external instruments are available, or, alternatively, used to supplement external instruments to improve the efficiency of the IV estimator. (5) ranktest implements the Kleibergen-Paap rk test for the rank of a matrix. Tests of the rank of a matrix have many practical applications. For example, in econometrics the requirement for identification is the rank condition, which states that a particular matrix must be of full column rank. Another example from econometrics concerns cointegration in vector autoregressive (VAR) models; the Johansen trace test is a test of a rank of a particular matrix. The Kleibergen-Paap rk statistic is a generalization of the Anderson canonical correlation rank test to the case of a non-Kronecker covariance matrix. The implementation in ranktest will calculate rk statistics that are robust to various forms of heteroskedasticity, autocorrelation, and clustering (see avar). (6) ivreg2 provides extensions to Stata's IV estimation facilities. Its main capabilities: two-step feasible GMM estimation; continuously updated GMM estimation (CUE); LIML and k-class estimation; automatic output of the Hansen-Sargan or Anderson-Rubin statistic for overidentifying restrictions; tests of exogeneity of subsets of instruments; statistics that are robust to various forms of heteroskedasticity, autocorrelation, and clustering (see avar); first-stage regression reported with Angrist-Pischke F-tests and R-squareds; tests for underidentification and weak instruments.
Original languageEnglish
PublisherResearch Papers in Economics (RePEc) - Statistical Software Components
Media of outputOnline
Publication statusPublished - 2013

Fingerprint Dive into the research topics of 'Stata software for econometric estimation and testing; avar, weakiv, actest, ivreg2h, ranktest, ivreg2'. Together they form a unique fingerprint.

  • Cite this

    Schaffer, M. E. (Developer), Baum, C. (Developer), Finlay, K. (Developer), Kleibergen, F. (Developer), Magnusson, L. (Developer), & Stillman, S. (Developer). (2013). Stata software for econometric estimation and testing; avar, weakiv, actest, ivreg2h, ranktest, ivreg2. Software, Research Papers in Economics (RePEc) - Statistical Software Components. Retrieved from