help for ivreg2

advertisement
--------------------------------------------------------------------------------------------------------help for ivreg2
--------------------------------------------------------------------------------------------------------Extended instrumental variables/2SLS, GMM and AC/HAC, LIML and k-class regression
Full syntax
ivreg2 depvar [varlist1] (varlist2=varlist_iv) [weight] [if exp] [in range] [, gmm bw(#)
kernel(string) liml fuller(#) kclass(#) coviv cue cueinit(matrix) cueoptions(string) robust
cluster(varname) orthog(varlist_ex) endog(varlist_en) redundant(varlist_ex) fwl(varlist)
small noconstant hascons} first ffirst noid savefirst savefprefix(prefix) rf saverf
saverfprefix(prefix) nocollin noid level(#) noheader nofooter eform(string)
depname(varname) plus ]
Replay syntax
ivreg2 [, first ffirst rf level(#) noheader nofooter eform(string) depname(varname) plus ]}
Version syntax
ivreg2, version
ivreg2 may be used with time-series or panel data, in which case the data must be tsset before using
ivreg2; see help tsset.
All varlists may contain time-series operators; see help varlist.
by, rolling, statsby, xi, bootstrap and jackknife are allowed, as is svy with jackknife VCE; see help
prefix.
aweights, fweights, iweights and pweights are allowed; see help weights.
The syntax of predict following ivreg2 is
predict [type] newvarname [if exp] [in range] [, statistic]
where statistic is
1
xb
residuals
stdp
fitted values; the default
residuals
standard error of the prediction
These statistics are available both in and out of sample; type "predict ... if e(sample) ..." if wanted
only for the estimation sample.
Contents
Description
Calculation of robust, AC, HAC standard errors
GMM estimation
LIML, k-class and GMM-CUE estimation
Summary of robust, HAC, AC, GMM, LIML and CUE options
Testing overidentifying restrictions
Testing subsets of regressors and instruments for endogeneity
Tests of under- and weak identification and instrument redundancy
First stage regressions, identification, and weak-id-robust inference
Reduced form estimates
Estimating the Frisch-Waugh-Lovell regression
OLS and Heteroskedastic OLS (HOLS) estimation
Collinearities
Speed options: nocollin and noid
Small sample corrections
Options summary
Remarks and saved results
Examples
References
Acknowledgements
Authors
Citation of ivreg2
Description
ivreg2 implements a range of single-equation estimation methods for the linear regression model: OLS,
instrumental variables (IV, also known as two-stage least squares, 2SLS), the generalized method of
moments (GMM), limited-information maximum likelihood (LIML), and k-class estimators. In the language of
IV/GMM, varlist1 are the exogenous regressors or "included instruments", varlist_iv are the exogenous
variables excluded from the regression or "excluded instruments", and varlist2 the endogenous regressors
that are being "instrumented".
2
ivreg2 will also estimate linear regression models using robust (heteroskedastic-consistent),
autocorrelation-consistent (AC) and heteroskedastic and autocorrelation-consistent (HAC) variance
estimates.
ivreg2 provides extensions to Stata's official ivreg and newey. ivreg2 supports the same command syntax
as official ivreg and (almost) all of its options. The main extensions available are as follows:
two-step feasible GMM estimation (gmm option) and continuously-updated GMM estimation (cue option); LIML
and k-class estimation; automatic output overidentification and underidentification test statistics; C
statistic test of exogeneity of subsets of instruments (orthog() option); endogeneity tests of endogenous
regressors (endog() option); test of instrument redundancy (redundant() option); kernel-based
autocorrelation-consistent (AC) and heteroskedastic and autocorrelation consistent (HAC) standard errors
and covariance estimation (bw(#) option), with user-specified choice of kernel (kernel() option); default
reporting of large-sample statistics (z and chi-squared rather than t and F); small option to report
small-sample statistics; first-stage regressions reported with various tests and statistics for
identification and instrument relevance; ffirst option to report only these identification statistics and
not the first-stage regression results themselves; nofooter option to suppress footer of regression
output. ivreg2 can also be used for ordinary least squares (OLS) estimation using the same command
syntax as official regress and newey.
+------------------------------------------------+
----+ Calculation of robust, AC, HAC standard errors +--------------------------------------------The standard errors reported by ivreg2 can be made consistent in the presence of a variety of violations
of the assumption of i.i.d. errors: (1) robust causes ivreg2 to report standard errors that are robust
to the presence of arbitrary heteroskedasticity; (2) cluster standard errors are robust to both arbitrary
heteroskedasticity and arbitrary intra-group correlation; (3) bw(#) requests AC standard errors that are
robust to arbitrary autocorrelation; (4) bw(#) combined with robust requests HAC standard errors that are
robust to both arbitrary heteroskedasticity and arbitrary autocorrelation.
ivreg2 allows a variety of options for kernel-based HAC and AC estimation. The bw(#) option sets the
bandwidth used in the estimation and kernel(string) is the kernel used; the default kernel is the
Bartlett kernel, also known in econometrics as Newey-West (see help newey). ivreg2 can also be used for
kernel-based estimation with panel data, i.e., a cross-section of time series. Before using ivreg2 for
kernel-based estimation of time series or panel data, the data must be tsset; see help tsset.
+----------------+
----+ GMM estimation +-----------------------------------------------------------------------------
3
When combined with the above options, the gmm option generates efficient estimates of the coefficients as
well as consistent estimates of the standard errors. The gmm option implements the two-step efficient
generalized method of moments (GMM) estimator. The efficient GMM estimator minimizes the GMM criterion
function J=N*g'*W*g, where N is the sample size, g are the orthogonality or moment conditions (specifying
that all the exogenous variables, or instruments, in the equation are uncorrelated with the error term)
and W is a weighting matrix. In two-step efficient GMM, the efficient or optimal weighting matrix is the
inverse of an estimate of the covariance matrix of orthogonality conditions. The efficiency gains of
this estimator relative to the traditional IV/2SLS estimator derive from the use of the optimal weighting
matrix, the overidentifying restrictions of the model, and the relaxation of the i.i.d. assumption. For
an exactly-identified model, the efficient GMM and traditional IV/2SLS estimators coincide, and under the
assumptions of conditional homoskedasticity and independence, the efficient GMM estimator is the
traditional IV/2SLS estimator. For further details, see Hayashi (2000), pp. 206-13, and 226-27.
The efficient GMM estimators available with gmm correspond to the above choices for consistent standard
errors: (1) used on its own, gmm causes ivreg2 to report coefficient estimates that are efficient in
presence of arbitrary heteroskedasticity; (2) gmm combined with cluster generates coefficient estimates
that are efficient in the presence of arbitrary heteroskedasticity and arbitrary intra-group group
correlation; (3) gmm plus bw(#) requests coefficient estimates that are efficient in the presence of
arbitrary autocorrelation; (4) gmm plus bw(#) and robust generates coefficient estimates that are
efficient in the presence of both arbitrary heteroskedasticity and arbitrary autocorrelation.
+--------------------------------------+
----+ LIML, k-class and GMM-CUE estimation +------------------------------------------------------Maximum-likelihood estimation of a single equation of this form (endogenous RHS variables and excluded
instruments) is known as limited-information maximum likelihood or LIML. The overidentifying
restrictions test reported after LIML estimation is the Anderson-Rubin (1950) overidentification
statistic in a homoskedastic context. LIML, OLS and IV/2SLS are examples of k-class estimators. LIML is
a k-class estimator with k=the LIML eigenvalue lambda; 2SLS is a k-class estimator with k=1; OLS is a
k-class esimator with k=0. Estimators based on other values of k have been proposed. Fuller's modified
LIML (available with the fuller(#) option) sets k = lambda - alpha/(N-L), where lambda is the LIML
eigenvalue, L = number of instruments (included and excluded), and the Fuller parameter alpha is a
user-specified positive constant. Nagar's bias-adjusted 2SLS estimator can be obtained with the
kclass(#) option by setting k = 1 + (L-K)/N, where L-K = number of overidentifying restrictions and N =
the sample size. For a discussion of LIML and k-class estimators, see Davidson and MacKinnon (1993, pp.
644-51).
The GMM generalization of the LIML estimator to the case of possibly heteroskedastic and autocorrelated
disturbances is the "continuously-updated" GMM estimator or CUE of Hansen, Heaton and Yaron (1996). The
4
CUE estimator directly maximizes the GMM objective function J=N*g'*W(b_cue)*g, where W(b_cue) is an
optimal weighting matrix that depends on the estimated coefficients b_cue. cue combined with robust,
cluster, and/or bw, generates coefficient estimates that are efficient in the presence of the
corresponding deviations from homoskedasticity. Specifying cue with no other options is equivalent to
the combination of the options liml and coviv. The CUE estimator requires numerical optimization
methods, and the implementation here uses Stata's ml routine. The starting values are either IV or
two-step efficient GMM coefficient estimates; these can be overridden with the cueinit option, which
takes the matrix of starting values b as its argument. cueoptions passes options to Stata's ml; see help
ml. Estimation with the cue option can be slow and problematic, and it should be used with caution.
+-------------------------------------------------------+
----+ Summary of robust, HAC, AC, GMM, LIML and CUE options +-------------------------------------To summarize the robust, HAC, AC, GMM, LIML and CUE options:
robust => heteroskedastic-robust SEs
gmm => heteroskedastic-efficient two-step GMM estimator
robust+gmm => same as gmm
bw => autocorrelation-robust SEs
bw+robust => heteroskedastic and autocorrelation-robust SEs
bw+gmm => autocorrelation-efficient two-step GMM estimator
bw+robust+gmm => heteroskedastic and autocorrelation-efficient two-step GMM estimator
liml => LIML estimation with non-robust SEs
liml+coviv => LIML estimation with alternative non-robust SEs
liml+robust => LIML estimation with heteroskedastic-robust SEs
cue => same as liml+coviv
cue+robust => heteroskedastic-efficient continuously-updated GMM estimator
cue+bw => autocorrelation-efficient continuously-updated GMM estimator
cue+bw+robust => heteroskedastic and autocorrelation-efficient continuously updated GMM estimator
For further details, see Hayashi (2000), pp. 206-13 and 226-27 (on GMM estimation), Wooldridge (2002), p.
193 (on cluster-robust GMM), and Hayashi (2000), pp. 406-10 or Cushing and McGarvey (1999) (on
kernel-based covariance estimation).
+--------------------------------------+
----+ Testing overidentifying restrictions +------------------------------------------------------The Sargan-Hansen test is a test of overidentifying restrictions. The joint null hypothesis is that the
instruments are valid instruments, i.e., uncorrelated with the error term, and that the excluded
5
instruments are correctly excluded from the estimated equation. Under the null, the test statistic is
distributed as chi-squared in the number of overidentifying restrictions. A rejection casts doubt on the
validity of the instruments. For the efficient GMM estimator, the test statistic is Hansen's J
statistic, the minimized value of the GMM criterion function. For the 2SLS estimator, the test statistic
is Sargan's statistic, typically calculated as N*R-squared from a regression of the IV residuals on the
full set of instruments. Under the assumption of conditional homoskedasticity, Hansen's J statistic
becomes Sargan's statistic. The J statistic is consistent in the presence of heteroskedasticity and (for
HAC-consistent estimation) autocorrelation; Sargan's statistic is consistent if the disturbance is
homoskedastic and (for AC-consistent estimation) if it is also autocorrelated. With gmm, robust and/or
cluster, Hansen's J statistic is reported. In the latter case the statistic allows observations to be
correlated within groups. For further discussion see e.g. Hayashi (2000, pp. 227-8, 407, 417).
The Sargan statistic can also be calculated after ivreg or ivreg2 by the command overid. The features of
ivreg2 that are unavailable in overid are the J statistic and the C statistic; the overid options
unavailable in ivreg2 are various small-sample and pseudo-F versions of Sargan's statistic and its close
relative, Basmann's statistic. See help overid (if installed).
+---------------------------------------------------------------+
----+ Testing subsets of regressors and instruments for endogeneity +-----------------------------The C statistic (also known as a "GMM distance" or "difference-in-Sargan" statistic) implemented using
the orthog option, allows a test of a subset of the orthogonality conditions, i.e., it is a test of the
exogeneity of one or more instruments. It is defined as the difference of the Sargan-Hansen statistic of
the equation with the smaller set of instruments (valid under both the null and alternative hypotheses)
and the equation with the full set of instruments, i.e., including the instruments whose validity is
suspect. Under the null hypothesis that both the smaller set of instruments and the additional, suspect
instruments are valid, the C statistic is distributed as chi-squared in the number of instruments tested.
Note that failure to reject the null hypothesis requires that the full set of orthogonality conditions be
valid; the C statistic and the Sargan-Hansen test statistics for the equations with both the smaller and
full set of instruments should all be small. The instruments tested may be either excluded or included
exogenous variables. If excluded exogenous variables are being tested, the equation that does not use
these orthogonality conditions omits the suspect instruments from the excluded instruments. If included
exogenous variables are being tested, the equation that does not use these orthogonality conditions
treats the suspect instruments as included endogenous variables. To guarantee that the C statistic is
non-negative in finite samples, the estimated covariance matrix of the full set orthogonality conditions
is used to calculate both Sargan-Hansen statistics (in the case of simple IV/2SLS, this amounts to using
the MSE from the unrestricted equation to calculate both Sargan statistics). If estimation is by LIML,
the C statistic reported is now based on the Sargan-Hansen test statistics from the restricted and
unrestricted equation. For further discussion, see Hayashi (2000), pp. 218-22 and pp. 232-34.
6
Endogeneity tests of one or more endogenous regressors can implemented using the endog option. Under the
null hypothesis that the specified endogenous regressors can actually be treated as exogenous, the test
statistic is distributed as chi-squared with degrees of freedom equal to the number of regressors tested.
The endogeneity test implemented by ivreg2, is, like the C statistic, defined as the difference of two
Sargan-Hansen statistics: one for the equation with the smaller set of instruments, where the suspect
regressor(s) are treated as endogenous, and one for the equation with the larger set of instruments,
where the suspect regressors are treated as exogenous. Also like the C statistic, the estimated
covariance matrix used guarantees a non-negative test statistic. Under conditional homoskedasticity,
this endogeneity test statistic is numerically equal to a Hausman test statistic; see Hayashi (2000, pp.
233-34). The endogeneity test statistic can also be calculated after ivreg or ivreg2 by the command
ivendog. Unlike the Durbin-Wu-Hausman tests reported by ivendog, the endog option of ivreg2 can report
test statistics that are robust to various violations of conditional homoskedasticity; the ivendog option
unavailable in ivreg2 is the Wu-Hausman F-test version of the endogeneity test. See help ivendog (if
installed).
+-------------------------------------------------------------------+
----+ Tests of under- and weak identification and instrument redundancy +-------------------------ivreg2 automatically reports tests of both underidentification and weak identification. The Anderson
(1984) canonical correlations test is a likelihood-ratio test of whether the equation is identified,
i.e., that the excluded instruments are "relevant", meaning correlated with the endogenous regressors.
The null hypothesis of the test is that the matrix of reduced form coefficients has rank=K-1 where
K=number of regressors, i.e, that the equation is underidentified. Under the null of
underidentification, the statistic is distributed as chi-squared with degrees of freedom=(L-K+1) where
L=number of instruments (included+excluded). A rejection of the null indicates that the model is
identified. Important: a result of rejection of the null should be treated with caution, because weak
instrument problems may still be present. See Hall et al. (1996) for a discussion of this test, and
below for discussion of testing for the presence of weak instruments. Note: the Anderson canonical
correlations test assumes the regressors are distributed as multivariate normal.
The test for weak identification automatically reported by ivreg2 is based on the Cragg-Donald (1993) F
statistic, a close relative of the Anderson canonical correlations statistic. Denoting the minimum
eigenvalue of the canonical correlations as CCEV and the minimum eigenvalue of the Cragg-Donald statistic
as CDEV, CDEV=CCEV/(1-CCEV), the Anderson LR test statistic is -N*ln(1-CCEV) and the Cragg-Donald F
statistic is CDEV*(N-L)/L2, where L is the number of instruments and L2 is the number of excluded
instruments. "Weak identification" arises when the excluded instruments are correlated with the
endogeous regressors, but only weakly. Estimators can perform poorly when instruments are weak, and
different estimators are more robust to weak instruments (e.g., LIML) than others (e.g., IV); see, e.g.,
7
Stock and Yogo (2002, 2005) for further discussion. Stock and Yogo (2005) have compiled critical values
for the Cragg-Donald F statistic for several different estimators (IV, LIML, Fuller-LIML), several
different definitions of "perform poorly" (based on bias and test size), and a range of configurations
(up to 100 excluded instruments and up to 2 or 3 endogenous regressors, depending on the estimator).
ivreg2 will report the Stock-Yogo critical values if these are available; missing values mean that the
critical values haven't been tabulated or aren't applicable. See Stock and Yogo (2002, 2005) for
details. The critical values reported by ivreg2 for (2-step) GMM are the IV critical values, and the
critical values reported for CUE are the LIML critical values. Note that the test statistic and the
critical values assume conditional homoskedasticity and independence. In the special case of a single
endogenous regressor, a robust test statistic for weak instruments is available with the first or ffirst
options; see below under First stage regressions.
The redundant option allows a test of whether a subset of excluded instruments is "redundant". Excluded
instruments are redundant if the asymptotic efficiency of the estimation is not improved by using them.
The test statistic is a likelihood-ratio test based on the canonical correlations between the regressors
and the instruments with, and without, the instruments being tested. Under the null that the specified
instruments are redundant, the statistic is distributed as chi-squared with degrees of
freedom=(#endogenous regressors)*(#instruments tested). Rejection of the null indicates that the
instruments are not redundant. See Hall and Peixe (2000) for further discussion of this test. Note:
this test assumes the regressors are distributed as multivariate normal.
Calculation and reporting of all underidentification and weak identification statistics can be supressed
with the noid option.
+-----------------------------------------------------------------------+
----+ First stage regressions, identification, and weak-id-robust inference +---------------------The first and ffirst options report various first-stage results and identification statistics. Both the
Anderson canonical correlations likelihood-ratio test statistic -N*ln(1-EV) and its close relative, the
chi-squared version of the Cragg-Donald (1993) test statistic N*(EV/(1-EV)), are reported; both are tests
of whether the equation is identified (see above). The first-stage results also include Shea's (1997)
"partial R-squared" measure of instrument relevance that takes intercorrelations among instruments into
account, the more common form of "partial R-squared" (a.k.a. the "squared partial correlation" between
the excluded instruments and the endogenous regressor in question), and the F-test of the excluded
instruments in the corresponding first-stage regression. When the model has only one endogenous
regressor, (a) the two measures of "partial R-squared" coincide; (b) the F-stat form of the Cragg-Donald
statistic coincides with the (non-robust) first-stage F-test of the excluded instruments. The two
partial R-squared measures, the F statistic, the degrees of freedom of the F statistic, and the p-value
of the F statistic for each endogenous variable are saved in the matrix e(first). The first-stage
8
results are always reported with small-sample statistics, to be consistent with the recommended use of
the first-stage F-test as a diagnostic. If the estimated equation is reported with robust standard
errors, the first-stage F-test is also robust. Note that in the special case of only one endogenous
regressor, this provides a robust test of weak or underidentification.
The first-stage output also includes two statistics that provide weak-instrument robust inference for
testing the significance of the endogenous regressors in the structural equation being estimated. The
first statistic is the Anderson-Rubin (1949) test (not to be confused with the Anderson-Rubin
overidentification test for LIML estimation; see above). The second is the closely related Stock-Wright
(2000) S statistic. The null hypothesis tested in both cases is that the coefficients of the endogenous
regressors in the structural equation are jointly equal to zero, and, in addition, that the
overidentifying restrictions are valid. Both tests are robust to the presence of weak instruments. The
tests are equivalent to estimating the reduced form of the equation (with the full set of instruments as
regressors) and testing that the coefficients of the excluded instruments are jointly equal to zero. In
the form reported by ivreg2, the Anderson-Rubin statistic is a Wald test and the Stock-Wright statistic
is a GMM-distance test. Both statistics are distributed as chi-squared with L2 degrees of freedom, where
L2=number of excluded instruments. The traditional F-stat version of the Anderson-Rubin test is also
reported. See Stock and Wright (2000), Dufour (2003), Chernozhukov and Hansen (2005) and Kleibergen
(2007) for further discussion. For related alternative test statistics that are also robust to weak
instruments, see condivreg and the corresponding discussion in Moreira and Poi (2003) and Mikusheva and
Poi (2006).
The savefirst option requests that the individual first-stage regressions are saved for later access
using the estimates command. If saved, they can also be displayed using first or ffirst and the ivreg2
replay syntax. The regressions are saved with the prefix "_ivreg2_", unless the user specifies an
alternative prefix with the savefprefix(prefix) option.
+------------------------+
----+ Reduced form estimates +--------------------------------------------------------------------The rf option requests that the reduced form estimation of the equation be displayed. The saverf option
requests that the reduced form estimation is saved for later access using the estimates command. If
saved, it can also be displayed using the rf and the ivreg2 replay syntax. The regression is saved with
the prefix "_ivreg2_", unless the user specifies an alternative prefix with the saverfprefix(prefix)
option.
+-----------------------------------------------+
----+ Estimating the Frisch-Waugh-Lovell regression +----------------------------------------------
9
The fwl(varlist) option requests that the exogenous regressors in varlist are "partialled out" from all
the other variables (other regressors and excluded instruments) in the estimation. If the equation
includes a constant, it is also automatically partialled out as well. The coefficients corresponding to
the regressors in varlist are not calculated. By the Frisch-Waugh-Lovell (FWL) theorem, the coefficients
for the remaining regressors are the same as those that would be obtained if the variables were not
partialled out. The fwl option is most useful when using cluster and #clusters < (#exogenous regressors
+ #excluded instruments). In these circumstances, the covariance matrix of orthogonality conditions S is
not of full rank, and efficient GMM and overidentification tests are infeasible since the optimal
weighting matrix W = S^-1 cannot be calculated. The problem can be addressed by using fwl to partial out
enough exogenous regressors for S to have full rank. A similar problem arises when the regressors
include a variable that is a singleton dummy, i.e., a variable with one 1 and N-1 zeros or vice versa, if
a robust covariance matrix is requested. The singleton dummy causes the robust covariance matrix
estimator to be less than full rank. In this case, partialling-out the variable with the singleton dummy
solves the problem. Specifying fwl(_cons) will cause just the constant to be partialled-out, i.e., the
equation will be estimated in deviations-from-means form. Note that variable counts are not adjusted for
the partialled-out variables. This means that the model degrees of freedom do not include the
partialled-out variables, and any small-sample statistics such as t or F statistics will be affected.
Also note that after estimation using the fwl option, the post-estimation predict can be used only to
generate residuals, and that in the current implementation, fwl is not compatible with instruments
(included or excluded) that use time-series operators.
+-----------------------------------------------+
----+ OLS and Heteroskedastic OLS (HOLS) estimation +---------------------------------------------ivreg2 also allows straightforward OLS estimation by using the same syntax as regress, i.e., ivreg2
depvar varlist1. This can be useful if the user wishes to use one of the features of ivreg2 in OLS
regression, e.g., AC or HAC standard errors.
If the list of endogenous variables varlist2 is empty but the list of excluded instruments varlist_iv is
not, and the option gmm is specified, ivreg2 calculates Cragg's "heteroskedastic OLS" (HOLS) estimator,
an estimator that is more efficient than OLS in the presence of heteroskedasticity of unknown form (see
Davidson and MacKinnon (1993), pp. 599-600). If the option bw(#) is specified, the HOLS estimator is
efficient in the presence of arbitrary autocorrelation; if both bw(#) and robust are specified the HOLS
estimator is efficient in the presence of arbitrary heteroskedasticity and autocorrelation; and if
cluster(varname) is used, the HOLS estimator is efficient in the presence of arbitrary heteroskedasticity
and within-group correlation. The efficiency gains of HOLS derive from the orthogonality conditions of
the excluded instruments listed in varlist_iv. If no endogenous variables are specified and gmm is not
specified, ivreg2 reports standard OLS coefficients. The Sargan-Hansen statistic reported when the list
of endogenous variables varlist2 is empty is a Lagrange multiplier (LM) test of the hypothesis that the
10
excluded instruments varlist_iv are correctly excluded from the restricted model. If the estimation is
LIML, the LM statistic reported is now based on the Sargan-Hansen test statistics from the restricted and
unrestricted equation. For more on LM tests, see e.g. Wooldridge (2002), pp. 58-60. Note that because
the approach of the HOLS estimator has applications beyond heteroskedastic disturbances, and to avoid
confusion concerning the robustness of the estimates, the estimators presented above as "HOLS" are
described in the output of ivreg2 as "2-Step GMM", "CUE", etc., as appropriate.
+----------------+
----+ Collinearities +----------------------------------------------------------------------------ivreg2 checks the lists of included instruments, excluded instruments, and endogenous regressors for
collinearities and duplicates. If an endogenous regressor is collinear with the instruments, it is
reclassified as exogenous. If any endogenous regressors are collinear with each other, some are dropped.
If there are any collinearities among the instruments, some are dropped. In Stata 9+, excluded
instruments are dropped before included instruments. If any variables are dropped, a list of their names
are saved in the macros e(collin) and/or e(dups). Lists of the included and excluded instruments and the
endogenous regressors with collinear variables and duplicates removed are also saved in macros with "1"
appended to the corresponding macro names.
Collinearity checks can be supressed with the nocollin option.
+----------------------------------+
----+ Speed options: nocollin and noid +----------------------------------------------------------Two options are available for speeding execution. nocollin specifies that the collinearity checks not be
performed. noid suspends calculation and reporting of the underidentification and weak identification
statistics in the main output.
+--------------------------+
----+ Small sample corrections +------------------------------------------------------------------Mean square error = sqrt(RSS/(N-K)) if small, = sqrt(RSS/N) otherwise.
If robust is chosen, the finite sample adjustment (see [R] regress) to the robust variance-covariance
matrix qc = N/(N-K) if small, qc = 1 otherwise.
If cluster is chosen, the finite sample adjustment qc = (N-1)/(N-K)*M/(M-1) if small, where M=number of
clusters, qc = 1 otherwise.
11
The Sargan and C (difference-in-Sargan) statistics use error variance = RSS/N, i.e., there is no small
sample correction.
A full discussion of these computations and related topics can be found in Baum, Schaffer, and Stillman
(2003) and Baum, Schaffer and Stillman (2007). Some features of the program postdate the 2003 article.
Options summary
gmm requests the two-step efficient GMM estimator. If no endogenous variables are specified, the
estimator is Cragg's HOLS estimator. See help ivgmm0 (if installed) for more details.
bw(#) impements AC or HAC covariance estimation with bandwidth equal to #, where # is an integer greater
than zero. Specifying robust implements HAC covariance estimation; omitting it implements AC
covariance estimation.
kernel(string)) specifies the kernel to be used for AC and HAC covariance estimation; the default kernel
is Bartlett (also known in econometrics as Newey-West). Other kernels available are (abbreviations
in parentheses): Truncated (tru); Parzen (par); Tukey-Hanning (thann); Tukey-Hamming (thamm);
Daniell (dan); Tent (ten); and Quadratic-Spectral (qua or qs).
Note: in the cases of the Bartlett, Parzen, and Tukey-Hanning/Hamming kernels, the number of lags
used to construct the kernel estimate equals the bandwidth minus one. Stata's official newey
implements HAC standard errors based on the Bartlett kernel, and requires the user to specify the
maximum number of lags used and not the bandwidth; see help newey. If these kernels are used with
bw(1), no lags are used and ivreg2 will report the usual Eicker/Huber/White/sandwich variance
estimates.
liml requests the limited-information maximum likelihood estimator.
fuller(#) specifies that Fuller's modified LIML estimator is calculated using the user-supplied Fuller
parameter alpha, a non-negative number. Alpha=1 has been suggested as a good choice.
kclass(#) specifies that a general k-class estimator is calculated using the user-supplied #, a
non-negative number.
coviv specifies that the matrix used to calculate the covariance matrix for the LIML or k-class estimator
is based on the 2SLS matrix, i.e., with k=1. In this case the covariance matrix will differ from
that calculated for the 2SLS estimator only because the estimate of the error variance will differ.
12
The default is for the covariance matrix to be based on the LIML or k-class matrix.
cue requests the GMM continuously-updated estimator (CUE).
cueinit(matrix) specifies that the starting values for the CUE estimator use those in a user-supplied
matrix b. If omitted, the default behavior is to use starting values from IV or 2-step efficient GMM
estimation.
cueopt(string) passes user-specified options to Stata's ml routine; see help ml.
robust specifies that the Eicker/Huber/White/sandwich estimator of variance is to be used in place of the
traditional calculation. robust combined with cluster() further allows residuals which are not
independent within cluster (although they must be independent between clusters). See [U] Obtaining
robust variance estimates.
cluster(varname) specifies that the observations are independent across groups (clusters) but not
necessarily independent within groups. varname specifies to which group each observation belongs;
e.g., cluster(personid) in data with repeated observations on individuals. cluster() can be used
with pweights to produce estimates for unstratified cluster-sampled data, but see help svyreg for a
command especially designed for survey data. Specifying cluster() implies robust.
orthog(varlist_ex) requests that a C-statistic be calculated as a test of the exogeneity of the
instruments in varlist_ex. These may be either included or excluded exogenous variables. The
standard order condition for identification applies: the restricted equation that does not use these
variables as exogenous instruments must still be identified.
endog(varlist_en) requests that a C-statistic be calculated as a test of the endogeneity of the
endogenous regressors in varlist_en.
redundant(varlist_ex) requests a likelihood-ratio test of the redundancy of the instruments in
varlist_ex. These must be excluded exogenous variables. The standard order condition for
identification applies: the restricted equation that does not use these variables as exogenous
instrumenst must still be identified.
small requests that small-sample statistics (F and t-statistics) be reported instead of large-sample
statistics (chi-squared and z-statistics). Large-sample statistics are the default. The exception
is the statistic for the significance of the regression, which is always reported as a small-sample F
statistic.
13
noconstant suppresses the constant term (intercept) in the regression. If noconstant is specified, the
constant term is excluded from both the final regression and the first-stage regression. To include
a constant in the first-stage when noconstant is specified, explicitly include a variable containing
all 1's in varlist_iv.
first requests that the full first-stage regression results be displayed, along with the associated
diagnostic and identification statistics.
ffirst requests the first-stage diagnostic and identification statistics.
various e() macros.
The results are saved in
nocollin suppresses the checks for collinearities and duplicate variables.
noid suppresses the calculation and reporting of underidentification and weak identification statistics.
savefirst requests that the first-stage regressions results are saved for later access using the
estimates command. The names under which the first-stage regressions are saved are the names of the
endogenous regressors prefixed by "_ivreg2_". If these use Stata's time-series operators, the "." is
replaced by a "_". The maximum number of first-stage estimation results that can be saved depends on
how many other estimation results the user has already saved and on the maximum supported by Stata
(20 for Stata 8.2 and 9.0, 300 for Stata 9.1).
savefprefix(prefix) requests that the first-stage regression results be saved using the user-specified
prefix instead of the default "_ivreg2_".
rf requests that the reduced-form estimation of the equation be displayed.
saverf requests that the reduced-form estimation of the equation be saved for later access using the
estimates command. The estimation is stored under the name of the dependent variable prefixed by
"_ivreg2_". If this uses Stata's time-series operators, the "." is replaced by a "_".
saverfprefix(prefix) requests that the reduced-form estimation be saved using the user-specified prefix
instead of the default "_ivreg2_".
level(#) specifies the confidence level, in percent, for confidence intervals of the coefficients; see
help level.
noheader, eform(), depname() and plus are for ado-file writers; see [R] ivreg and [R] regress.
14
nofooter suppresses the display of the footer containing identification and overidentification
statistics, exogeneity and endogeneity tests, lists of endogenous variables and instruments, etc.
version causes ivreg2 to display its current version number and to leave it in the macro e(version).
cannot be used with any other options. and will clear any existing e() saved results.
It
Remarks and saved results
ivreg2 does not report an ANOVA table. Instead, it reports the RSS and both the centered and uncentered
TSS. It also reports both the centered and uncentered R-squared. NB: the TSS and R-squared reported by
official ivreg is centered if a constant is included in the regression, and uncentered otherwise.
ivreg2 saves the following results in e():
Scalars
e(N)
e(yy)
e(yyc)
e(rss)
e(mss)
e(df_m)
e(df_r)
e(r2u)
e(r2c)
e(r2)
e(r2_a)
e(ll)
e(rankxx)
e(rankzz)
e(rankV)
e(rankS)
e(rmse)
e(F)
e(N_clust)
e(bw)
e(lambda)
e(kclass)
e(fuller)
e(sargan)
Number of observations
Total sum of squares (SS), uncentered (y'y)
Total SS, centered (y'y - ((1'y)^2)/n)
Residual SS
Model SS =yyc-rss if the eqn has a constant, =yy-rss otherwise
Model degrees of freedom
Residual degrees of freedom
Uncentered R-squared, 1-rss/yy
Centered R-squared, 1-rss/yyc
Centered R-squared if the eqn has a constant, uncentered otherwise
Adjusted R-squared
Log likelihood
Rank of the matrix of observations on rhs variables=K
Rank of the matrix of observations on instruments=L
Rank of covariance matrix V of coefficients
Rank of covariance matrix S of orthogonality conditions
root mean square error=sqrt(rss/(N-K)) if -small-, =sqrt(rss/N) otherwise
F statistic
Number of clusters
Bandwidth
LIML eigenvalue
k in k-class estimation
Fuller parameter alpha
Sargan statistic
15
e(sarganp)
e(sargandf)
e(j)
e(jp)
e(jdf)
e(arubin)
e(arubinp)
e(arubindf)
e(idstat)
e(idp)
e(iddf)
e(cdf)
e(cdchi2)
e(cdchi2p)
e(arf)
e(arfp)
e(archi2)
e(archi2p)
e(ardf)
e(ardf_r)
e(redstat)
e(redp)
e(reddf)
e(cstat)
e(cstatp)
e(cstatdf)
e(cons)
e(fwlcons)
Macros
e(cmd)
e(version)
e(model)
e(depvar)
e(instd)
e(insts)
e(inexog)
e(exexog)
e(collin)
p-value of Sargan statistic
dof of Sargan statistic = degree of overidentification = L-K
Hansen J statistic
p-value of Hansen J statistic
dof of Hansen J statistic = degree of overidentification = L-K
Anderson-Rubin overidentification LR statistic
p-value of Anderson-Rubin overidentification LR statistic
dof of A-R overid statistic = degree of overidentification = L-K
Anderson canonical correlations LR statistic
p-value of Anderson canonical correlations LR statistic
dof of Anderson canonical correlations LR statistic
Cragg-Donald F statistic
Cragg-Donald chi-sq statistic
p-value of Cragg-Donald chi-sq statistic
Anderson-Rubin F-test of significance of endogenous regressors
p-value of Anderson-Rubin F-test of endogenous regressors
Anderson-Rubin chi-sq test of significance of endogenous regressors
p-value of Anderson-Rubin chi-sq test of endogenous regressors
degrees of freedom of Anderson-Rubin tests of endogenous regressors
denominator degrees of freedom of AR F-test of endogenous regressors
LR statistic for instrument redundancy
p-value of LR statistic for instrument redundancy
dof of LR statistic for instrument redundancy
C-statistic
p-value of C-statistic
Degrees of freedom of C-statistic
1 when equation has a Stata-supplied constant; 0 otherwise
as above but prior to partialling-out (see e(fwl))
ivreg2
Version number of ivreg2
ols, iv, gmm, liml, or kclass
Name of dependent variable
Instrumented (RHS endogenous) variables
Instruments
Included instruments (regressors)
Excluded instruments
Variables dropped because of collinearities
16
e(dups)
e(ecollin)
e(clist)
e(redlist)
e(fwl)
e(small)
e(wtype)
e(wexp)
e(clustvar)
e(vcetype)
e(kernel)
e(tvar)
e(ivar)
e(firsteqs)
e(rfeq)
e(predict)
Duplicate variables
Endogenous variables reclassified as exogenous because of
collinearities with instruments
Instruments tested for orthogonality
Instruments tested for redundancy
Partialled-out exogenous regressors
small
weight type
weight expression
Name of cluster variable
Covariance estimation method
Kernel
Time variable
Panel variable
Names of stored first-stage equations
Name of stored reduced-form equation
Program used to implement predict
Matrices
e(b)
e(V)
e(S)
e(W)
e(first)
e(ccev)
e(cdev)
Coefficient vector
Variance-covariance matrix of the estimators
Covariance matrix of orthogonality conditions
GMM weighting matrix (=inverse of S if efficient GMM estimator)
First-stage regression results
Eigenvalues corresponding to the Anderson canonical correlations test
Eigenvalues corresponding to the Cragg-Donald test
Functions
e(sample)
Marks estimation sample
Examples
. use http://fmwww.bc.edu/ec-p/data/hayashi/griliches76.dta
(Wages of Very Young Men, Zvi Griliches, J.Pol.Ec. 1976)
. xi i.year
17
(Instrumental variables.
Examples follow Hayashi 2000, p. 255.)
. ivreg2 lw s expr tenure rns smsa _I* (iq=med kww age mrt)
. ivreg2 lw s expr tenure rns smsa _I* (iq=med kww age mrt), small ffirst
(Testing for the presence of heteroskedasticity in IV/GMM estimation)
. ivhettest, fitlev
(Two-step GMM efficient in the presence of arbitrary heteroskedasticity)
. ivreg2 lw s expr tenure rns smsa _I* (iq=med kww age mrt), gmm
(Continuously-updated GMM (CUE) efficient in the presence of arbitrary heteroskedasticity.
require 50+ iterations.)
NB: may
. ivreg2 lw s expr tenure rns smsa _I* (iq=med kww age mrt), cue robust
(Sargan-Basmann tests of overidentifying restrictions for IV estimation)
. ivreg2 lw s expr tenure rns smsa _I* (iq=med kww age mrt)
. overid, all
(Tests of exogeneity and endogeneity)
(Test the exogeneity of 1 regressor)
. ivreg2 lw s expr tenure rns smsa _I* (iq=med kww age mrt), gmm orthog(s)
(Test the exogeneity of 2 excluded instruments)
. ivreg2 lw s expr tenure rns smsa _I* (iq=med kww age mrt), gmm orthog(age mrt)
(Frisch-Waugh-Lovell (FWL): equivalence of estimations with and without partialling-out)
. ivreg2 lw s expr tenure rns smsa _I* (iq=med kww age), cluster(year)
18
. ivreg2 lw s expr tenure rns smsa _I* (iq=med kww age), cluster(year) fwl(_I*)
(FWL: efficient GMM with #clusters<#instruments feasible after partialling-out)
. ivreg2 lw s expr tenure rns smsa (iq=med kww age), cluster(year) fwl(_I*) gmm
(Examples following Wooldridge 2002, pp.59, 61)
. use http://fmwww.bc.edu/ec-p/data/wooldridge/mroz.dta
(Test an excluded instrument for redundancy)
. ivreg2 lwage exper expersq (educ=age kidslt6 kidsge6), redundant(age)
(Equivalence of DWH endogeneity test when regressor is endogenous...)
. ivreg2 lwage exper expersq (educ=age kidslt6 kidsge6)
. ivendog educ
(... endogeneity test using the endog option)
. ivreg2 lwage exper expersq educ (educ=age kidslt6 kidsge6), endog(educ)
(...and C-test of exogeneity when regressor is exogenous, using the orthog option)
. ivreg2 lwage exper expersq educ (=age kidslt6 kidsge6), orthog(educ)
(Heteroskedastic Ordinary Least Squares, HOLS)
. ivreg2 lwage exper expersq educ (=age kidslt6 kidsge6), gmm
(LIML and k-class estimation using Klein data)
. use http://fmwww.bc.edu/repec/bocode/k/kleinI
(LIML estimates of Klein's consumption function)
. ivreg2 consump L.profit (profit wages = govt taxes trend wagegovt capital1 L.demand), liml
19
(Equivalence of LIML and CUE+homoskedasticity+independence)
. ivreg2 consump L.profit (profit wages = govt taxes trend wagegovt capital1 L.demand), liml
coviv
. ivreg2 consump L.profit (profit wages = govt taxes trend wagegovt capital1 L.demand), cue
(Fuller's modified LIML with alpha=1)
. ivreg2 consump L.profit (profit wages = govt taxes trend wagegovt capital1 L.demand), fuller(1)
(k-class estimation with Nagar's bias-adjusted IV, k=1+(L-K)/N=1+4/21=1.19)
. ivreg2 consump L.profit (profit wages = govt taxes trend wagegovt capital1 L.demand),
kclass(1.19)
(Kernel-based covariance estimation using time-series data)
. use http://fmwww.bc.edu/ec-p/data/wooldridge/phillips.dta
. tsset year, yearly
(Autocorrelation-consistent (AC) inference in an OLS Regression)
. ivreg2 cinf unem, bw(3)
(Heteroskedastic and autocorrelation-consistent (HAC) inference in an OLS regression)
. ivreg2 cinf unem, bw(3) kernel(bartlett) robust small
. newey cinf unem, lag(2)
(AC and HAC in IV and GMM estimation)
. ivreg2 cinf (unem = l(1/3).unem), bw(3)
. ivreg2 cinf (unem = l(1/3).unem), bw(3) gmm kernel(thann)
20
. ivreg2 cinf (unem = l(1/3).unem), bw(3) gmm kernel(qs) robust orthog(l1.unem)
(Examples using Large N, Small T Panel Data)
. 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
(Autocorrelation-consistent inference in an IV regression)
. ivreg2 n (w k ys = d.w d.k d.ys d2.w d2.k d2.ys), bw(1) kernel(tru)
(Two-step effic. GMM in the presence of arbitrary heteroskedasticity and autocorrelation)
. ivreg2 n (w k ys = d.w d.k d.ys d2.w d2.k d2.ys), bw(2) gmm kernel(tru) robust
(Two-step effic. GMM in the presence of arbitrary heterosked. and intra-group correlation)
. ivreg2 n (w k ys = d.w d.k d.ys d2.w d2.k d2.ys), gmm cluster(id)
References
Anderson, T.W. 1984. Introduction to Multivariate Statistical Analysis.
Sons.
2d ed. New York: John Wiley &
Anderson, T. W., and H. Rubin. 1949. Estimation of the parameters of a single equation in a complete
system of stochastic equations. Annals of Mathematical Statistics, Vol. 20, pp. 46-63.
Anderson, T. W., and H. Rubin. 1950. The asymptotic properties of estimates of the parameters of a single
equation in a complete system of stochastic equations. Annals of Mathematical Statistics, Vol. 21,
pp. 570-82.
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. Working paper version: Boston College
Department of Economics Working Paper No 545. http://ideas.repec.org/p/boc/bocoec/545.html
Baum, C. F., Schaffer, M. E., and Stillman, S. 2007. Enhanced routines for instrumental variables/GMM
21
estimation and testing. Unpublished working paper, forthcoming.
Chernozhukov, V. and Hansen, C. 2005. The Reduced Form: A Simple Approach to Inference with Weak
Instruments. Working paper, University of Chicago, Graduate School of Business.
Cragg, J.G. and Donald, S.G. 1993. Testing Identfiability and Specification in Instrumental Variables
Models. Econometric Theory, Vol. 9, pp. 222-240.
Cushing, M.J. and McGarvey, M.G. 1999. Covariance Matrix Estimation. In L. Matyas (ed.), Generalized
Methods of Moments Estimation. Cambridge: Cambridge University Press.
Davidson, R. and MacKinnon, J. 1993. Estimation and Inference in Econometrics.
University Press.
1993. New York: Oxford
Dufour, J.M. 2003. Identification, Weak Instruments and Statistical Inference in Econometrics. Canadian
Journal of Economics, Vol. 36, No. 4, pp. 767-808. Working paper version: CIRANO Working Paper
2003s-49. http://www.cirano.qc.ca/pdf/publication/2003s-49.pdf
Hall, A.R. and Peixe, F.P.M. 2000. A Consistent Method for the Selection of Relevant Instruments.
Econometric Society World Congress 2000 Contributed papers.
http://econpapers.repec.org/paper/ecmwc2000/0790.htm
Hall, A.R., Rudebusch, G.D. and Wilcox, D.W. 1996. Judging Instrument Relevance in Instrumental
Variables Estimation. International Economic Review, Vol. 37, No. 2, pp. 283-298.
Hayashi, F. Econometrics. 2000. Princeton: Princeton University Press.
Hansen, L.P., Heaton, J., and Yaron, A. 1996. Finite Sample Properties of Some Alternative GMM
Estimators. Journal of Business and Economic Statistics, Vol. 14, No. 3, pp. 262-280.
Kleibergen, F. 2007. Generalizing Weak Instrument Robust Statistics Towards Multiple Parameters,
Unrestricted Covariance Matrices and Identification Statistics. Journal of Econometrics,
forthcoming.
Mikusheva, A. and Poi, B.P. 2006. Tests and confidence sets with correct size when instruments are
potentially weak. The Stata Journal, Vol. 6, No. 3, pp. 335-347.
Moreira, M.J. and Poi, B.P. 2003. Implementing Tests with the Correct Size in the Simultaneous
Equations Model. The Stata Journal, Vol. 3, No. 1, pp. 57-70.
22
Shea, J. 1997. Instrument Relevance in Multivariate Linear Models:
Economics and Statistics, Vol. 49, No. 2, pp. 348-352.
Stock, J.H. and Wright, J.H. 2000.
September, pp. 1055-1096.
GMM with Weak Identification.
A Simple Measure.
Review of
Econometrica, Vol. 68, No. 5,
Stock, J.H. and Yogo, M. 2005. Testing for Weak Instruments in Linear IV Regression. In D.W.K. Andrews
and J.H. Stock, eds. Identification and Inference for Econometric Models: Essays in Honor of Thomas
Rothenberg. Cambridge: Cambridge University Press, 2005, pp. 80–108. Working paper version: NBER
Technical Working Paper 284. http://www.nber.org/papers/T0284.
Wooldridge, J.M. 2002. Econometric Analysis of Cross Section and Panel Data.
Cambridge, MA: MIT Press.
Acknowledgements
We would like to thanks various colleagues who helped us along the way, including David Drukker, Austin
Nichols, Vince Wiggins, and, not least, the users of ivreg2 who have provided suggestions, spotted bugs,
and helped test the package. We are also grateful to Jim Stock and Moto Yogo for permission to reproduce
their critical values for the Cragg-Donald statistic.
Citation of ivreg2
ivreg2 is not an official Stata command. It is a free contribution to the research community, like a
paper. Please cite it as such:
Baum, C.F., Schaffer, M.E., Stillman, S. 2007. ivreg2: Stata module for extended instrumental
variables/2SLS, GMM and AC/HAC, LIML and k-class regression.
http://ideas.repec.org/c/boc/bocode/s425401.html
Authors
Christopher F Baum, Boston College, USA
baum@bc.edu
Mark E Schaffer, Heriot-Watt University, UK
m.e.schaffer@hw.ac.uk
23
Steven Stillman, Motu Economic and Public Policy Research
stillman@motu.org.nz
Also see
Manual:
On-line:
[U] 23 Estimation and post-estimation commands,
[U] 29 Overview of model estimation in Stata,
[R] ivreg
help for ivreg, newey; overid, ivendog, ivhettest, ivreset, xtivreg2, xtoverid, condivreg (if
installed); est, postest; regress
24
Download