*! version 2.4.02 9feb2015
help weakiv

Title

weakiv -- Weak-instrument-robust tests and confidence intervals
for instrumental-variable (IV) estimation of linear, panel, probit and tobit models

Syntax

Standalone estimation (specifying model to be estimated):

weakiv
iv_cmd
depvar [varlist1]
(varlist2=varlist_iv) [weight]
[if exp] [in range]
[, model_options
test_options ci_options graph_options misc_options]

Obtaining model from previous call to ivregress, ivreg2, ivreg2h,
xtivreg, xtivreg2, xtabond2, ivprobit, or ivtobit:

weakiv
[, test_options ci_options graph_options misc_options]

Replay syntax:

weakiv
[, graph_options project(varlist) project2(var1 var2) misc_options]

iv_cmd/model_options

iv_cmd
ivregress, ivreg2, ivreg2h, xtivreg, xtivreg2, it:xtabond2}, ivprobit, or ivtobit

<misc>
options supported by ivregress, ivreg2, ivreg2h, xtivreg, xtivreg2, xtabond2, ivprobit or ivtobit

test_options

null(numlist)
null hypotheses for tests of coefficients on weakly-identified endogenous variables in IV model

kwt(#)
weight on K test statistic in K-J test (see also kjlevel(.) option below)

lm
use Lagrange multiplier tests (available for linear models only)

md
use Wald/Minimum Distance tests (all models)

strong(varlist)
names of strongly-identified endogenous regressors (if not all are weakly identified)

cuestrong
use LIML or CUE for strongly-identified endogenous regressors (instead of default IV or 2-step GMM)

cuepoint
report LIML or CUE point estimates for weakly-identified endogenous regressors
and include in grid if grid search used
(linear models only; reporting option only, does not affect test statistics)

subset(varlist)
endogenous regressors for subset AR test (multiple-endogenous regressor case only)

testexog(varlist)
exogenous regressors to be included in the reported tests (optional)

clrsims(#)
number of reps for simulating distribution of the CLR statistic (default=use closed-form method if available, use 10,000 reps if not);
clrsims(0) means do not simulate (use closed-form or report missing value)

small
makes small-sample adjustment

eq(diff/lev/sys)
(xtabond2 only) use (only equation in differences / only equation in levels / both) for weak-ID-robust tests

ci_options

usegrid
construct grid for confidence-interval estimation, graphs etc.

noci
supress reporting/calculation of confidence intervals

project(varlist)
endogenous regressors for projection-based confidence intervals (multiple-endogenous regressor case only)

project2(var1 var2)
2 endogenous regressors for projection-based confidence set (multiple-endogenous regressor case only)

gridpoints(numlist)
number(s) of grid points (in dimensions corresponding to endogenous regressors)

gridmult(#)
multiplier of Wald confidence-interval for grid

gridmin(numlist)
lower limit(s) for grid search (in dimensions corresponding to endogenous regressors)

gridmax(numlist)
upper limit(s) for grid search (in dimensions corresponding to endogenous regressors)

grid(numlist [ | numlist [ | numlist ... ] ] )
explicit list(s) of grid points (in dimensions corresponding to endogenous regressors); if multiple lists, separated by "|"

level(numlist)
default confidence level(s) for confidence intervals and sets (max 3)

arlevel(#)
optional confidence level for AR confidence intervals

jlevel(#)
optional confidence level for J confidence intervals

kjlevel(#)
(usage 1) optional overall confidence level for K-J confidence intervals and tests

kjlevel(#k #j)
(usage 2) optional separate confidence levels for K and J in K-J confidence intervals and tests

graph_options

graph(namelist)
graph test rejection probabilities and confidence intervals (ar, clr, k, j, kj, wald)

graphxrange(numlist)
lower and upper limits of x axis for graph of test statistics
(option unavailable for 2-endogenous regressor case)

graphopt(string)
graph options to pass to graph command
(applies to combined contour/surface graph in 2-endogenous regressor case)

2-endogenous-regressor usage
contouropt(string)
graph options to pass to contour graph command

surfaceopt(string)
graph options to pass to surface graph command

contouronly
do contour plot (confidence set) only; suppress surface plot

surfaceonly
do surface plot (rejection probability surface) only; supress contour plot

misc_options

estadd[(prefix)]
add main weakiv results (scalars and macros) to model estimated by IV for Wald tests;
estimation results obtained from previous call to
ivregress, ivreg2, ivreg2h,
xtivreg, xtivreg2, xtabond2,
ivprobit or ivtobit
remain in memory with weakiv results added;
prefix is an optional prefix added to names of scalars and macros
(not available with replay syntax)

estusewald(name)
obtain IV model from stored previous estimation by
ivregress, ivreg2, ivreg2h,
xtivreg, xtivreg2, xtabond2,
ivprobit or ivtobit

eststorewald(name)
store IV model used for Wald tests
(estimated by ivregress, ivreg2, ivreg2h,
xtivreg, xtivreg2, xtabond2,
ivprobit or ivtobit)
under name

displaywald
display model estimated by IV for Wald tests
(not available with replay syntax)

Contents

Description

Tests, confidence intervals, rejection probabilities

Summary interpretations of weakiv output: 1 endogenous regressor

Summary interpretations of weakiv output: 2 endogenous regressors

Summary interpretations of weakiv output: Projection-based inference for 2+ endogenous regressors

Options

Model options

Test options

Confidence interval estimation

Graphing options

Miscellaneous options

Examples

General use

Confidence interval and grid examples

Graphing examples

estadd option and other miscellaneous examples

Saved results

Acknowledgements

References

Citation of weakiv

Description

weakiv performs a set of tests of the coefficient(s) on the endogenous variable(s)
in an instrumental variables (IV) model,
and constructs confidence sets for these coefficients.
These tests and confidences are robust to weak instruments
in the sense that identification of the coefficients is not assumed.
This is in contrast to the traditional IV/GMM estimation methods,
where the validity of tests on estimated coefficients requires the assumption that they are identified.

weakiv can be used to estimate linear
(including panel fixed effects, first diffences, and dynamic panel data),
probit and tobit IV models.
weakiv supports a range of variance-covariance estimators for linear IV models
including heteroskedastic-, autocorrelation-, and one- and two-way cluster-robust VCEs.
weakiv also provides graphics options that allow the plotting of
confidence intervals and rejection probabilities (one endogenous regressor),
and confidence regions and rejection surfaces (two endogenous regressors).

weakiv can estimate models with any number of endogenous regressors.
There are several options available for models with 2 or more endogenous regressors.
(a) The user can specify, using the strong(.) option,
that some coefficients are strongly identifed,
in which case weakiv will report tests for the
weakly-identified subset of coefficients.
(b) The project(.) option requests the reporting
of conservative projection-based confidence intervals
for the specified endogenous regressors.
(c) The project2(.) option requests the construction of
2-dimensional projection-based confidence sets
for the 2 specified endogenous regressors.
These 2-D confidence sets can be graphed using the graph(.) option.
(d) The subset(.) option specifies that
only the listed subset of endogenous regressors is tested.
The subset test is available only for i.i.d. linear models (including linear panel models)
and only the subset AR test is available.

For estimations with 1 weakly-identified coefficient,
weakiv reports tests of the specified null,
confidence intervals, and provides graphing options.
For estimations with 2 weakly-identified coefficients,
weakiv reports tests of the specified null
and provides graphing options for confidence sets and rejection surfaces.
For estimations with more than 2 weakly-identified coefficients,
weakiv reports only tests of the specified null hypothesis.
The default null is that all weakly-identified coefficients are zero.

weakiv can be used either as a standalone estimator
where the user provides the specification of the model,
or after previous IV/GMM estimation by ivregress, ivreg2, ivreg2h,
xtivreg, xtivreg2, xtabond2, ivprobit or ivtobit.

When used as a standalone estimator,
weakiv works by calling ivregress, ivreg2, ivreg2h,
xtivreg, xtivreg2, xtabond2, ivprobit or ivtobit
depending what the user has specified as iv_cmd.
weakiv passes all user-specified model estimation options
to the estimation command:
variable lists, VCE specification, estimation method, etc.

When used with a model previously estimated by
ivregress, ivreg2, ivreg2h,
xtivreg, xtivreg2, xtabond2,
ivprobit or ivtobit,
weakiv obtains the model specification from the previous estimation.
This is either the model currently in memory,
or the stored model provided by the user in usemodel(name).

weakiv also supports Stata replay syntax.
If the weakiv results are the current estimation in memory,
weakiv with no model specified will replay them.
This can be used to tweak the graph options
without weakiv having to recalculate the full set of estimation results (see below).
The project(.) and project2(.) options are also available with replay syntax.

weakiv requires avar (Baum and Schaffer 2013) to be installed.
The graphing options for the 2-endogenous-regressor case require Stata 12 or higher
for the contour plots of confidence regions,
and require version 1.06 or higher of surface (Mander 2005)
for the 3-D plots of rejection surfaces.
weakiv will prompt the user for installation of
avar and surface if necessary.
avar is an essential component and weakiv will not run without it.
Neither graph contour nor surface is an essential component;
weakiv will run but will not provide the corresponding graphs.

Estimator notes:

Except where noted below,
weakiv supports the variance-covariance estimation options available
with ivregress, ivreg2, ivreg2h, xtivreg, xtabond2 and xtivreg2.
Weights that are supported by each IV command are also supported by weakiv.

ivtobit
Only variance-covariance estimation options that assume homoskedasticity are supported.

ivprobit
The twostep option (Newey's (1987) two-step estimator) is required.
Only variance-covariance estimation options that assume homoskedasticity are supported.

ivreg2h
(IV estimation using heteroskedasticity-based instruments)
The gen option of ivreg2h is required
in order to generate the new instruments as variables.

xtivreg
Only the fixed-effects and first-differences estimators are supported.

xtabond2
If weakiv used as a postestimation command after xtabond2,
the preceding estimation by xtabond2 requires the svmat
option to save the xtabond2-transformed data as e(.) matrices.
The svmat option is not required
if weakiv used for standalone estimation (weakiv xtabond2 ...).
Support for xtabond2 requires matafavor to be set for speed;
to do this type or click
mata mata set matafavor speed.

Tests, confidence intervals, rejection probabilities

weakiv calculates Lagrange multiplier (LM) or minimum distance (MD)
versions of weak-instrument-robust tests of the coefficient
on the endogenous variable beta in an instrumental variables (IV) estimation.
In an exactly-identified model where the number of instruments
equals the number of endogenous regressors,
it reports the Anderson-Rubin (AR) test statistic.
When the IV model contains more instruments than endogenous regressors
(the model is overidentified),
weakiv also conducts the conditional likelihood ratio (CLR) test,
the Lagrange multiplier K test, the J overidentification test,
and a combination of the K and overidentification tests (K-J).

The default behavior of weakiv is to report LM versions of these tests for linear models,
and MD versions for the IV probit and IV tobit models.
The MD versions of these tests can be requested by the md option;
for linear models, these are equivalent to Wald-type tests.
The LM versions of these tests are not available for IV probit/tobit models.
In the current implementation of weakiv,
the CLR test is available for the 1-endog-regressor case only.
For reference, weakiv also reports a Wald test
using the relevant traditional IV parameter and VCE estimators;
this Wald test is identical to what would be obtained by
standard estimation using
ivregress, ivreg2, ivreg2h,
xtivreg, xtivreg2, xtabond2,
ivprobit or ivtobit.

The AR test is a joint test of the structural parameter
(beta=b0, where beta is the coefficient on the endogenous regressor)
and the exogeneity of the instruments
(E(Zu)=0, where Z are the instruments
and u is the disturbance in the structural equation).
The AR statistic can be decomposed into the K statistic
(which tests only H0:beta=b0,
assuming the exogeneity conditions E(Zu)=0 are satisfied)
and the J statistic
(which tests only H0:E(Zu)=0,
assuming that beta=b0 is true).
This J statistic is evaluated at the null hypothesis,
as opposed to the Hansen J statistic from GMM estimation,
which is evaluated at the parameter estimate.

The CLR test is a related approach to testing H0:beta=b0.
It has good power properties,
and in particular is the most powerful test for the linear model under homoskedasticity
(within a class of invariant similar tests).
An important advantage of the CLR test over the K test is that
the K test can lose power in some regions of the parameter space
when the objective function has a local extremum or inflection point;
the CLR test does not suffer from this problem.
The CLR test is a function of a rank statistic rk.
For the case of more than one endogenous regressor,
there are several such rank tests available;
weakiv employs the SVD-based test of Kleibergen and Paap (2006)
(see e.g. ranktest,
which has the computational advantage of a closed-form solution.
The rank statistic rk can also be interpreted
as a test of underidentification of the model (see Kleibergen 2005);
under the null hypothesis that the model is underidentified,
rk has a chi-squared distribution.

The CLR test statistic has a non-standard distribution.
For the case of i.i.d. linear models with a single weakly-identified endogenous regressor,
weakiv uses the fast and accurate algorithm
implemented by Mikusheva and Poi (2006).
The default behavior of weakiv for non-i.i.d. and nonlinear models
with a single weakly-identified endogenous regressor
is to use the same algorithm to obtain p-values for the CLR test;
although this is not the correct p-value function for these cases,
the simulations by Finlay and Magnusson (2009) suggest it provides
a good approximation.
For all models with multiple endogenous regressors,
weakiv obtains the p-value by simulation;
the seed for the random number generator is temporarily set to the value 12345
so that the resulting p-values are replicable.
The default number of simulations is 10,000;
this can be altered using the clrsims(#) option.
This option can also be used to override the default behavior
of the i.i.d.-linear-model algorithm
with single-endogenous regressor models.
A larger number of simulations will give a more accurate p-value
but can slow execution, especially in grid searches.
The simulation method can be turned off completely
by specifying clrsims(0).

The K-J test combines the K and J statistics to jointly test
the structural parameter and the exogeneity of the instruments.
It is more efficient than the AR test and allows different weights or test levels
to be put on the parameter and overidentification hypotheses.
Unlike the K test,
the K-J test does not suffer from the problem of spurious power losses.
To perform the K-J test, the researcher specifies
the significance levels alpha_K and alpha_J for
the K and J statistics.
Because the K and J tests are independent,
the null of the K-J test is rejected
if either p_K<alpha_K
or p_J<alpha_J,
where p_K and p_J are the K and J p-values, respectively.
The overall size of the K-J test is given by (1-(1-alpha_K)*(1-alpha_J)).

The default behavior of weakiv is for the user to choose
the overall size of the K-J test
and the weights kwt and (1-kwt) to put on
the K and J components, respectively.
Alternatively, the user may specify
the separate significance levels alpha_K and alpha_J,
from which the overall K-J test size and weights are calculated.
The p-value function for the K-J test is
p=min(p1,p2), where
p1=(p_K/kwt)*(1-(1-kwt)*p_K) and
p2=(p_J/(1-kwt))*(1-kwt*p_J).
For large L% (e.g., 95%),
this is approximately equivalent to
rejecting the null at the (100-L)% significance level if
K is greater than the kwt*(100-L)% critical value or
J is greater than the (1-kwt)*(100-L)% critical value.
For example, if kwt=0.8 and (100-L)=5%,
then the text rejects if the p-value for the K test is below 4%
or the p-value for the J test is below 1%
(because (1-(1-0.04)*(1-0.01))=0.0496 which is approximately 0.05).

For the single-endogenous-regressor case,
weakiv also inverts these tests to obtain and report
weak-instrument-robust confidence intervals and
(with the graph(.) option),
the corresponding rejection probabilities.
In a graph of rejection probabilities,
an L% confidence interval is readily visualized
as the range of values for b0
such that the rejection probability for the statistic
lies below a horizontal line drawn at L%.
In the case of estimation of the i.i.d. linear model,
weakiv uses a closed-form solution for these confidence intervals.
Closed-form solutions for the J and K-J tests are unavailable;
to obtain confidence intervals for these tests,
specify the usegrid option.
In all other specifications (nonlinear or non-i.i.d.),
weakiv estimates confidence intervals by grid search.

For the 2-endogenous-regressors case,
weakiv uses a grid search and graphical methods
to report the corresponding confidence regions
and rejection probabilities.
In this case, the rejection probabilities form a 3-D rejection surface
where beta1, the coefficient on endogenous regressor 1, is plotted against the x-axis,
beta2, the coefficient on endogenous regressor 2, is plotted against the y-axis,
and the rejection probability is plotted against the z-axis (vertical axis).
An L% confidence region is the set of values
for b1 and b2 such that
the null hypothesis H0:beta1=b1 and beta2=b2 cannot be rejected.
In a 3-D graph of the rejection probability surface,
an L% confidence region is readily visualized
as the range of values for b1 and b2
such that the rejection surface lies below a horizontal plane drawn at L%.

weakiv can also accommodate models with multiple endogenous regressors,
where some coefficients are weakly identified and some are strongly identified.
weakiv supports this via the strong(.), subset(.),
project(.) and project2(.) options.

The strong(.) option is available for linear models only.
In effect, the strongly-identified coefficients are removed from the testing,
and weakiv reports tests, confidence intervals, graphs etc.
for the remaining weakly-identified coefficient(s).
Testing in this case follows the method of Kleibergen (2004);
see Mikusheva (2013) for a concise description.
Briefly, the method uses the standard formulae for weak-identification-robust statistics,
but for the strongly-identified coefficients replaces hypothesized values
with estimates obtained under the null from an efficient estimator.
The default efficient estimators are IV in the i.i.d. case
and 2-step efficient GMM in the non-i.i.d. case;
the cuestrong replaces these with
the LIML and CUE estimators, respectively
(note that the CUE estimator requires numerical optimization
and grid searches in particular will be slow with this option).
To obtain confidence intervals and rejection probabilities,
the procedure is repeated for each hypothesized value
of the weakly-identified coefficient(s).
Note that if a specific null hypothesis is to be tested
using the null(numlist) option,
the parameter values in numlist correspond to
the weakly-identified-coefficients only.

The subset(.) option implements the subset AR test of Guggenberger et al. (2012).
They show that a weak-instrument-robust AR test
of a subset of endogenous regressors can be performed by,
in effect, using LIML to estimate the coefficients on the regressors not in the subset.
This test is available for i.i.d. linear models only.

The project(.) option implements projection-based
confidence intervals for the listed weakly-identified endogenous variables.
A projection-based test for a coefficient H0:beta=b0 rejects the null
if the test statistic exceeds the test critical value
for every configuration of hypothesized coefficients
on all the other weakly-identified regressors.
It is conservative in the sense that it has asymptotic size
less than or equal to nominal size.
Intuitively, whereas a standard correctly-sized test
at the 5% significance level
will commit a Type I error 5% of the time,
a conservative projection-based test
will commit a Type I error at most 5% of the time.
See Guggenberger et al. (2012) for a discussion and references.
The projection-based confidence intervals implemented by
weakiv require grid search.
To get an accurate projection-based CI for a variable,
the user should specify a suitably large number of grid points
in that dimension.

For models with 3 or more weakly-identified endogenous regressors,
the project2(var1 var2) option implements projection-based
confidence sets for the 2 listed weakly-identified endogenous variables.
These confidence sets can be graphed with the graph(.) option.

To include exogenous regressors in the hypotheses tested,
the testexog(.) option can be used.
This also allows the user to construct and graph confidence sets
where one regressor is endogenous and one is exogenous.
Projection-based CIs for exogenous regressors can also be calculated.
These exogenous regressors are treated in the same way
as the possibly-weakly-identified endogenous regressors;
the only difference with the tests discussed above is that
an exogenous variable that is a regressor
and the coefficient for which appears in the null hypothesis
also appears in the orthogonality conditions E(Zu)=0.

The K and CLR confidence intervals and sets
are centered around the point estimates from the CUE
(continuously-updated GMM) estimator;
in the iid case, the CUE estimator reduces to the LIML estimator.
The CUE estimates cannot be used directly for inference,
but provide a useful reference point.
The cuepoint option requests that CUE estimates
for the weakly-identified endogenous regressors are reported
and included as points in the grid search
(if a grid is used, and only if the CUE estimates lie within the grid limits).
This option is primarily for reporting and will have no impact
on the weak-identification-robust tests.
It can be useful in graphing because
the K and CLR statistics are zero at the CUE point estimates
and the cuepoint option will guarantee
that this is visible in graphs of rejection probabilities and surfaces.
The option is available for linear models only.
The default CUE is the standard GMM CUE;
if Wald/MD tests are requested instead of the default LM tests,
the point estimates are those of the CUE-MD estimator
described in Magnusson (2010).
In both cases, the exogenous regressors are partialled out
before the CUE estimates are calculated.
(NB: In exactly-identified models,
the CUE, LIML and IV estimators coincide.)

The LM and MD weak-identification-robust tests implemented by weakiv are due to
Anderson and Rubin (1949),
Kleibergen (2002, 2005), Moreira (2003),
Magnusson (2010) and Guggenberger et al. (2012).
For the linear models supported by weakiv,
including the panel data fixed effects, first differences and dynamic panel data models,
the MD versions are equivalent to Wald versions of these tests.
In the construction of the LM versions of the tests,
any exogenous regressors are first partialled out.
For further discussion of these tests,
see Finlay and Magnusson (2009),
Kleibergen (2002, 2005),
Mikusheva (2013),
Moreira (2003),
Chernozhukov and Hansen (2005, 2008),
Magnusson (2010),
and the references therein.

Summary interpretations of weakiv output: 1 endogenous regressor

The following summarizes what the various statistics assume and test
in the single-endogenous-regressor case, and how to interpret the results.
The interpretations are similar for the mulitiple-endogenous-regressor case
when only one coefficient is weakly identified.
The structural parameter, beta, is the coefficient on the endogenous regressor;
b0 is a hypothesized value for beta;
the excluded instruments are Z;
the assumption that the instruments are exogenous is E(Zu)=0.
Roughly speaking,
a well-specified model is one in which
H0:beta=b0 cannot be rejected for a narrow range of hypothesized values b0
and the assumption of instrument exogeneity
cannot be rejected for a wide range of hypothesized values b0
(i.e., the exogeneity assumption is generally satisified).

An L% confidence interval is
the range of b0 such that the rejection probability (=1-pvalue) is below L%.
Users can use the graph(.) option to plot rejection probabilities.
The confidence intervals reported by weakiv can, in overdidentified models,
be empty, disjoint (composed of unconnected segments), open-ended,
or cover the entire range of possible values for beta.
An empty confidence interval (null set) means there is no possible value b0
that is consistent with the model;
this is an indication of misspecification when L% is fairly high.
Disjoint confidence intervals arise when the plot of the rejection probability
dips below L% in more than one range;
an example is when the K statistic has inflection points or local minima
that cause spurious power losses
(inspection of a graph of the K rejection probability is a way of detecting this).
Open-ended confidence intervals commonly arise when the grid
does not extend far enough to capture the point where the rejection probability
crosses above the L% line.
Interpretation of an L% confidence interval that covers
the entire grid range of possible values for beta
depends on the null hypothesis tested:
if the null hypothesis is H0:beta=b0,
it suggests the parameter beta is poorly identified or unidentified;
if the null hypothesis is H0:E(Zu)=0,
it suggests the exogeneity conditions are generally satisfied.

Summary of specific tests:

CLR
The null hypothesis is H0:beta=b0.
The exogeneity conditions E(Zu)=0 are assumed to be satisfied.
An L% confidence interval is the set of all values b0 such that
the null hypothesis beta=b0 cannot be rejected at the (100-L)% significance level.

K
The null hypothesis is H0:beta=b0.
The exogeneity conditions E(Zu)=0 are assumed to be satisfied.
An L% confidence interval is the set of all values b0 such that
the null hypothesis beta=b0 cannot be rejected at the (100-L)% significance level.

J
The null hypothesis is H0:E(Zu)=0.
The structural parameter is assumed to be beta=b0.
An L% confidence interval is the set of all values b0 such that
the null hypothesis E(Zu)=0 cannot be rejected at the (100-L)% significance level.
Note the differences in the null hypothesis
and interpretation of confidence intervals
vs. the CLR and K statistics.

K-J
(usage 1, specifying overall test level and weights on K and J)
The null hypothesis is
H0:beta=b0 and H0:E(Zu)=0.
For a test at significance (100-L)%
with weights on the K and J tests
of kwt and (1-kwt), respectively,
the null is rejected if
either
(a) K is greater than the critical value for
a test at the kwt*(100-L)% significance level,
or
(b) J is greater than the critical value for
a test at the (1-kwt)*(100-L)% significance level.
(This is interpretation is an approximation;
see the text above for the exact definition.)
An L% confidence interval is the set of all values b0 such that
the composite null hypothesis cannot be rejected at the (100-L)% significance level.

K-J
(usage 2, specifying test levels separately for K and J)
The null hypothesis is
H0:beta=b0 and H0:E(Zu)=0.
For a test at significance alpha_K for the K test
and alpha_J for the J test,
the null is rejected if
either
(a) K is greater than the critical value for
a test at the alpha_K significance level,
or
(b) J is greater than the critical value for
a test at the alpha_J significance level.
The significance level for the overall test is
(1-(1-alpha_K)*(1-alpha_J)).
An L% confidence interval is the set of all values b0 such that
the composite null hypothesis cannot be rejected at the (100-L)% significance level.

AR
The null hypothesis is
H0:beta=b0 and H0:E(Zu)=0.
For a test at significance (100-L)%
the null is rejected if
either (a) H0:beta<>b0,
or (b) H0:E(Zu)<>0.
An L% confidence interval is the set of all values b0 such that
the composite null hypothesis cannot be rejected at the (100-L)% significance level.

Wald
The null hypothesis is
H0:beta=b0.
Identification of beta in the IV estimation is assumed to be strong.
An L% confidence interval is the set of all values b0 such that
the null hypothesis cannot be rejected at the (100-L)% significance level.

Summary interpretations of weakiv output: 2 endogenous regressors

The following summarizes what the various statistics assume and test
in the two-endogenous-regressors case, and how to interpret the results.
The interpretations are similar for the mulitiple-endogenous-regressor case
when only two coefficients are weakly identified.
The structural parameters, beta1 and beta2,
are the coefficients on the endogenous regressors;
b1 and b2 are hypothesized values for beta1 and beta2, respectively.
Roughly speaking,
a well-specified model is one in which
H0:beta1=b1 and beta2=b2 cannot be rejected
for a narrow range of hypothesized values b1 and b2
(i.e., beta1 and beta2 are precisely estimated}
and the assumption of instrument exogeneity
cannot be rejected for a wide range of hypothesized values b1 and b2
(i.e., the exogeneity assumption is generally satisified).

An 2-dimensional confidence set is a straightforward extension
of a 1-dimensional confidence interval.
An L% confidence set is
the range of b1 and b2 such that
the rejection probability (=1-pvalue) is below L%.
weakiv uses graphical methods to report confidence sets and rejection probabilities;
these are specified using the graph(.) option.
A confidence set is graphed in x-y space as a contour plot
using Stata 12's graph twoway contour.
Up to 3 confidence levels can be specified using the levels(.) option;
these will be plotted as lower/higher contours in the contour plot.
The rejection probability is graphed in x-y-z space using Mander's (2005) surface;
the contours plotted by contour are the contours of this surface.
The confidence sets plotted by weakiv can, in overdidentified models,
be empty, disjoint (composed of unconnected regions), open-ended, etc.
An empty confidence set (null set) means
there is no possible combination of values b1 and b2
that is consistent with the model;
this is an indication of misspecification when L% is fairly high.
Disjoint confidence regions arise when the rejection probability surface
dips below L% in more than one range.
Open-ended confidence regions commonly arise when the grid
does not extend far enough to capture the point where the rejection probability
crosses above the L% plane.

Summary interpretations of weakiv output: Projection-based inference for 2+ endogenous regressors

A standard L% confidence interval is properly sized if
the probability that it will contain the true value of the parameter beta is L%.
By contrast, the probability that a projection-based L% confidence interval
will contain the true value of the parameter beta is at least L%.
In this sense the projection-based confidence intervals reported by weakiv are conservative.
Projection-based intervals for the 2-endogenous-regressor case are easily visualized.
For a 2-dimensional confidence set plotted in x-y space,
the projection-based confidence interval for variable x
is the range of the x axis where some part of the confidence set lies above or beneath;
the projection-based confidence interval for variable y
is the range of the y axis where some part of the confidence set lies to the left or to the right.
See below for an example.

A 2-dimensional projection-based confidence set for two endogenous variables
is an extension of the above:
the probability that a L% 2-D projection-based confidence set
contains the true values of the parameters beta1 and beta2
is at least L%.

Options

Model options (when used for standalone estimation)

iv_cmd specifies the IV estimator to use:
ivregress, ivreg2, ivreg2h,
xtivreg, xtivreg2, xtabond2, ivprobit or ivtobit.
This option is valid only when weakiv
is used for standalone estimation and the details of the model
are also provided; see Syntax above.

Testing

null(numlist) specifies the null hypothesis for the coefficient on the
endogenous variable(s) in the IV model. The default is
null(0) for 1 weakly-identified coefficient,
null(0 0) for 2 weakly-identified coefficients, etc.

kwt(#) is the weight put on the K test statistic in the K-J test.
The default is kwt(0.8).
It may not be used with the kjlevel(#k #j) option; see below.

lm specifies that LM tests instead of
the default Wald/Minimum Distance tests are reported (linear models only).

strong(varlist) specifies that,
in a multiple-endogenous-regressor estimation,
the coefficient(s) on the endogenous regressor(s) in varlist
is (are) strongly-identified (linear models only).
Tests and graphs are reported for the weakly-identified regressor(s) only.

cuestrong requests, for i.i.d. linear models,
that the LIML estimatior is used for the strongly-identified coefficients
in preference to the default IV estimator;
and for non-i.i.d. models,
that the CUE estimator is used in preference to
the default 2-step efficient GMM estimator.
The CUE estimator requires numerical optimization methods
and is noticably slower than 2-step GMM;
this will be particularly noticable when a grid search is used.

subset(varlist) specifies that,
in a multiple-endogenous-regressor estimation,
the weak-identification-robust subset AR test
is reported for the endogenous regressor(s)
in varlist (i.i.d. linear models only).

clrsims(#) specifies the number of draws to be used
in obtaining p-values for the CLR test by simulation.
The default is to use the linear-i.i.d.-single-endogenous-regressor
algorithm for models with one endogenous variable,
and 10,000 simulations otherwise.
The simulation method can be turned off by specifying clrsims(0).

small specifies that small-sample adjustments be made when test
statistics are calculated for linear IV estimation.
When used in standalone estimation by weakiv,
the default is not to employ small-sample adjustments.
When used after estimation of linear models,
the default is given by whatever small-sample
adjustment option was chosen in the IV command.
Small-sample adjustments are always made for IV probit and IV tobit estimation.
The default small-sample adjustment is N/(N-L)
where L is the number of exogenous variables (regressors and instruments);
for the fixed effects estimator, L includes the number of fixed effects;
if a cluster-robust VCE is used, the small-sample adjustment is
N_clust/(N_clust-1)*(N-1)/(N-L),
where N_clust is the number of clusters.

eq(diff/lev/sys) is specific to estimation by xtabond2.
This requests that only the specified equation(s) (differences, levels, or both)
are used for weak-identification-robust testing.

Confidence interval estimation

usegrid specifies that a grid search is conducted.
This will override the default analytic solution for
constructing confidence intervals for the i.i.d. linear model.
Under the other models, grid-based estimation
is the only available method for constructing confidence sets.

noci requests that confidence intervals not be estimated/reported.
Grid-based test inversion can be time-intensive,
so this option can save time if a grid search is not required,
either because confidence intervals are not needed
or because a closed-form solution for confidence intervals is available
(the i.i.d. linear model only).

project(varlist) requests reporting,
for a multiple-endogenous-regressor estimation,
conservative projection-based confidence intervals
for the endogenous regressor(s) in varlist.
project(_all) requests reporting these
for all weakly-identified coefficients.

project2(var1 var2) requests construction,
for a multiple-endogenous-regressor estimation,
a 2-dimensional projection-based confidence set
for endogenous regressors var1 and var2.
This confidence set can be graphed using the graph(.) option.

gridpoints(numlist) specifies the number of equally spaced values over
which to calculate the confidence sets.
The default number of gridpoints is
100, 25, 11, 7 and 5
for the cases of 1, 2, 3, 4 and 5 endogenous regressors, respectively.
If more than 5 endogenous regressors are specified,
the number of gridpoints must be explicitly provided by the user,
e.g., for 6 endogenous regressors the user can specify gridpoints(5 5 5 5 5 5).
The number of gridpoints can get easily get large in this case;
in this example, the total number of grid points searched is 5^6 = 15,625.
A large number of grid points will increase the required computation time,
but a greater number of grid points
will improve the precision of both graphs and confidence intervals.

Note: The default grid is centered around the Wald point estimate
(or the CUE point estimate if the cuepoint estimate is specified)
with a width equal to twice the Wald confidence interval.
With weak instruments,
this may often be too small a grid to estimate the confidence intervals and sets.

gridmult(#) is a way of specifying a grid to calculate confidence sets.
This option specifies that the grid be # times the size
of the Wald confidence interval. The default is gridmult(2).

gridmin(numlist) and gridmax(numlist)
together provide another way of specifying
the grid to calculate the confidence sets.
The user provides the lower limits
for the corresponding endogenous variable in gridmin(numlist),
and the upper limits in gridmax(numlist).
Each dimension will be split into equally-sized portions
as specified in gridpoints(numlist).

grid(numlist [ | numlist [ | numlist ... ] ] )
allows the user to list explicitly
the numeric values of the grid points over which to calculate the confidence sets.
If more than one weakly-identified endogenous regressor is specified,
the corresponding grid numlists should be separated by the "|" character.
This option is not compatible with any other grid options
and will override them if they are also specified.

level(#) specifies the default confidence level,
as a percentage, for confidence intervals.
The default is level(95) or as set by set level.
Changing level(#) also changes the level of significance
used to determine this result: [100-level(#)]%.
Up to 3 levels can be provided as level(numlist);
this option is useful for graphing,
when multiple confidence intervals or confidence sets
corresponding to different confidence levels
can be represented in the same graph.
If more than one level is provided, the first is used for tests.
The option can also be used to tweak graphs when weakiv's replay syntax is used.

arlevel(#) optionally specifies the confidence level, as a percentage,
for the AR confidence interval if different from the default confidence level.

jlevel(#) optionally specifies the confidence level, as a percentage,
for the J confidence interval if different from the default confidence level.

kjlevel(#) (usage 1) optionally specifies the overall confidence level, as a percentage,
for the K-J confidence interval if different from the default confidence level.

kjlevel(#k #j) (usage 2) optionally specifies the separate confidence levels,
as percentages, for the K and J tests in the construction of
the K-J test and confidence intervals.
The overall test level will be (1-(1-#k/100)*(1-#j/100)).
Note that this implicitly specifies the weight on the K and J tests
and may not be used with the kwt(#) option.

Graphing

graph(string) specifies the test rejection probabilities
to plot vs. the hypothesized value for the structural parameter.
Options available are ar, k, j, clr (1-endog-regressor case only),
kj, wald and all.
Fo exactly-identified models only ar and wald are available.
They may be specified in lower or upper case.
For the 1-endogenous-regressor case,
colors for the different rejection probabilities are preassigned
and do not change with the order or list of tests specified.
Default colors can be overridden with the graphopt(string) option.

graphxrange(numlist) allows the user to specify
the range of the x-axis in graph of rejection probabilities.
It is equivalent to adding "if x>=ll & x<=ul" in a Stata graph command,
where ll and ul are the lower and upper limits for the x-axis, respectively.
(NB: This option is not available for the 2-endogenous-regressor case.)
This option does not affect the limits of the grid search;
to specify these, use the gridmin(numlist) and gridmax(numlist) options.

graphopt(string) allows the user to specify additional graphing options,
such as titles, subtitle, colors, etc.
For the 1-endogenous-regressor case the internal graph command is scatter,
and weakiv will pass the full contents of graphopt(string) to it.
For the 2-endogenous-regressor case the internal graph command is graph combine
(to combine the contour and surface plots),
and weakiv will pass the full contents of graphopt(string) to it.

contouropt(string) allows the user to specify additional graphing options
to the internal call to Stata's graph contour or graph contourline commands.
The default is to display the 2-dimensional confidence sets
via shaded contour graphs using graph contour.
To request contour line graphs using graph contourline,
specify contouropt(contourline ...).
To request a scatterplot of grid points indicating the confidence set using graph scatter,
specify contouropt(scatter ...).
This last option can be useful for indicating visually the fineness or coarseness of the grid.

surfaceopt(string) allows the user to specify additional graphing options
to the internal call to Mander's (2005) surface command.

contouronly (2-endogenous-regressor case only)
specifies that only the contour plot (confidence set) is graphed;
the surface plot is not provided.

surfaceonly (2-endogenous-regressor case only)
specifies that only the surface plot (surface of rejection probabilities) is graphed;
the contour plot is not provided.

Miscellaneous options

estadd[(prefix)] causes weakiv) to mimic the behavior of estadd (Jann 2009).
When it is omitted, weakiv works like most eclass commands in Stata
and leaves behind in memory the full set of weakiv saved results and nothing else.
When estadd is specified,
weakiv leaves behind in memory the results of command used to estimate the IV model
(ivregress, ivreg2, ivreg2h, ivprobit or ivtobit)
but with weakiv results added to the estimation results (macros and scalars).
prefix is optional; when included,
the added results have the same names as used by weakiv
but with prefix added.

eststorewald(name)
stores the IV model estimated by
ivregress, ivreg2, ivreg2h, ivprobit or ivtobit
under name.

estusewald(name)}
obtains the IV model from a stored previous estimation by
ivregress, ivreg2, ivreg2h, ivprobit or ivtobit.

displaywald
displays the model estimated by IV for Wald tests prior to reporting weakiv results.

Examples

General use

Setup

. clear

. use http://www.stata.com/data/jwooldridge/eacsap/mroz.dta

. gen byte poshours=(hours>0)

Following estimation by ivregress; single endogenous regress.
Test significance of educ in the lwage equation (homoskedastic VCE).
Confidence intervals reported by default; no graphs requested.

. ivregress 2sls lwage exper expersq (educ = fatheduc motheduc)

. weakiv

Use as a standalone estimation command with ivreg2; single endogenous regressor.
Heteroskedastic-robust tests.
Graph AR, K, J and KJ tests.

. weakiv ivreg2 lwage exper expersq (educ = fatheduc motheduc), robust graph(ar k j kj)

Limited dependent variable estimation.
Standalone estimation syntax.
Note that partly because the grid has only 100 points and is not very fine,
in both cases the CLR and K confidence intervals appear identical.
Graph AR and CLR tests.

. weakiv ivtobit hours nwifeinc exper expersq age kidslt6 kidsge6 (educ = fatheduc motheduc), ll graph(ar clr)

. weakiv ivprobit poshours nwifeinc exper expersq age kidslt6 kidsge6 (educ = fatheduc motheduc), twostep graph(ar clr)

As in second example above, but slower and more accurate:
increase grid points to 500 and use simulation-based method of obtaining CLR p-values
with 1 million draws per simulation (per test, per grid point).
Note that compared to the previous example,
the CLR p-value for H0 has changed slightly,
and the CLR and K confidence intervals still start at the same gridpoint
but now end at slightly different gridpoints.
Standalone estimation syntax.
Graph AR and CLR tests.

. weakiv ivprobit poshours nwifeinc exper expersq age kidslt6 kidsge6 (educ = fatheduc motheduc), twostep graph(ar clr) gridpoints(500) clrsims(1000000)

Two weakly-identified endogenous regressors; robust VCE.
Report CUE and center grid on CUE point estimator.
Graph Wald and K tests using shaded contour plots.

. weakiv ivreg2 lwage exper expersq (educ hours = fatheduc motheduc kidslt6 kidsge6), rob cuepoint graph(wald k)

Two weakly-identified endogenous regressors; robust VCE.
Request test of specific null: education coeff=0.1 and exper coeff=0.05.
Limit the grid to 10x10 and use a scatterplot to illustrate the sparseness of the grid.

. weakiv ivreg2 lwage (educ exper = fatheduc motheduc kidslt6 kidsge6), robust null(0.1 0.05) gridpoints(10 10) graph(k) contouropt(scatter)

Two endogenous regressors, one weakly identified and one assumed strongly identified; robust VCE.
Graph Wald and AR tests.

. weakiv ivreg2 lwage exper expersq (educ hours = fatheduc motheduc kidslt6 kidsge6), rob strong(educ) graph(wald ar)

Two weakly-identified endogenous regressors; i.i.d. linear model; subset AR test for first regressor.

. weakiv ivreg2 lwage exper expersq (educ hours = fatheduc motheduc kidslt6 kidsge6), subset(educ)

Panel data setup

. clear

. webuse abdata, clear

First-differences estimation using xtivreg; fixed effects estimation using xtivreg2 and cluster-robust SEs.

. weakiv xtivreg ys k (n=l2.n l3.n), fd

. weakiv xtivreg2 ys k (n=l2.n l3.n), fe cluster(id)

Dynamic panel data estimation using xtabond2.
Example taken from xtabond2 help file examples:
system estimation, 5 endogenous regressors, cluster-robust VCE, small-sample correction.

. weakiv xtabond2 n l.n l(0/1).(w k) yr1980-yr1984, gmm(l.n w k) iv(yr1980-yr1984, mz) robust twostep h(2) small

As above, but construct a sparse 4x4x4x4x4=1,024 point grid.

. weakiv xtabond2 n l.n l(0/1).(w k) yr1980-yr1984, gmm(l.n w k) iv(yr1980-yr1984, mz) robust twostep h(2) small gridpoints(4 4 4 4 4)

Using the saved grid and postestimation syntax, construct a 2-D conservative projection-based confidence set for w and L.w.
Note the sparseness of the grid and that all 4x4=16 grid points are in the confidence set.

. weakiv, project2(w L.w) graph(k)

As above, but using only data in differences for weak-identification-robust tests:
3 endogenous regressors, cluster-robust VCE, small-sample correction.

. weakiv xtabond2 n l.n l(0/1).(w k) yr1980-yr1984, gmm(l.n w k) iv(yr1980-yr1984, mz) robust twostep h(2) small eq(diff)

As above, but test the specific null H0: coeff on L.n=0.3; coeff on w=0.2; coeff on k=0.1

. weakiv xtabond2 n l.n l(0/1).(w k) yr1980-yr1984, gmm(l.n w k) iv(yr1980-yr1984, mz) robust twostep h(2) small eq(diff) null(0.3 0.2 0.1)

As above, but construct and report conservative projection-based confidence intervals. Use a 10x10x10 grid.

. weakiv xtabond2 n l.n l(0/1).(w k) yr1980-yr1984, gmm(l.n w k) iv(yr1980-yr1984, mz) robust twostep h(2) small eq(diff) project(_all) gridpoints(10 10 10)

As above, using only data in differences, and specifying that the coefficient on lagged n is strongly identified:
3 endogenous regressors, 2 of which have weakly-identified coefficients, cluster-robust VCE, small-sample correction.
Request graph of Wald and CLR with grid of 40x40=1,600 points.

. weakiv xtabond2 n l.n l(0/1).(w k) yr1980-yr1984, gmm(l.n w k) iv(yr1980-yr1984, mz) robust twostep h(2) small eq(diff) strong(L.n) graph(wald clr) gridpoints(40 40)

Confidence interval and grid examples

Time-series setup

. clear

. use http://fmwww.bc.edu/ec-p/data/wooldridge/phillips.dta

. tsset year, yearly

As a standalone estimator using ivreg2. Estimate the confidence sets over a grid of 500 points.
Report MD (minimum-distance) rather than default LM stats; graph Wald and K stats.
First use default grid width of 2x the Wald confidence interval (centered around the IV point estimate).
Then use a wider grid of 3x the Wald CI
to remove the open-ended confidence intervals for K test.
Alternatively, specify the lower and upper limits of the grid.

. weakiv ivreg2 cinf (unem = l(1/3).unem), robust bw(3) md gridpoints(500) graph(wald k)

. weakiv ivreg2 cinf (unem = l(1/3).unem), robust bw(3) md gridpoints(500) graph(wald k) gridmult(3)

. weakiv ivreg2 cinf (unem = l(1/3).unem), robust bw(3) md gridpoints(500) graph(wald k) gridmin(-2) gridmax(1)

Setup

. clear

. use http://www.stata.com/data/jwooldridge/eacsap/mroz.dta

Two different uses of kjlevel(.) option.
(1) Specify an overall K-J test level of exactly 90%, equal weights on K in K-J,
and hence test levels for K in K-J of appx. 95% each.
(2) Specify test levels of exactly 95% for K in K-J,
and hence equal weights and an overall K-J test level of appx. 90%.
In both cases also specify a test level of 90% for the AR test.

. weakiv ivregress 2sls lwage exper expersq (educ = fatheduc motheduc), robust kjlevel(90) kwt(0.5) arlevel(90)

. di _col(5) %5.2f e(kj_level) _col(15) %5.2f e(kjk_level) _col(25) %5.2f e(kjj_level)

. weakiv ivregress 2sls lwage exper expersq (educ = fatheduc motheduc), robust kjlevel(95 95) arlevel(90)

. di _col(5) %5.2f e(kj_level) _col(15) %5.2f e(kjk_level) _col(25) %5.2f e(kjj_level)

Graphing examples

As a standalone estimation command. Graph the rejection probabilities of all 6 tests (robust VCE),
then use replay syntax to tweak graph options without having to reestimate.
Confidence intervals correspond to x-axis range where rejection probabilities are below 95% line.

. weakiv ivregress 2sls lwage exper expersq (educ = fatheduc motheduc), robust graph(all)

. weakiv, graph(ar clr wald) graphxrange(-0.05 0.15) graphopt(title("AR, CLR, Wald"))

Time-series setup

. clear

. use http://fmwww.bc.edu/ec-p/data/wooldridge/phillips.dta

. tsset year, yearly

As a standalone estimation command. Illustrates empty confidence interval, K spurious loss of power,
J test misspecification and relation to AR and K-J tests.

. weakiv ivreg2 cinf (unem = l(1/3).unem), robust bw(3) graph(ar k) graphopt(title("AR - empty, K - spurious power loss"))

. weakiv ivreg2 cinf (unem = l(1/2).unem), robust bw(3) graph(ar k j kj) gridpoints(800) gridmin(-1) gridmax(1) graphopt(title("J suggests misspecification"))

Two endogenous regressors.

. clear

. use http://www.stata.com/data/jwooldridge/eacsap/mroz.dta

. weakiv ivreg2 lwage (educ exper = fatheduc motheduc kidslt6 kidsge6), graph(wald ar)

Two endogenous regressors; estimate using robust VCE, grid of 30x30=900 points, graph K, request projection-based CIs.
Note how the projection-based CI for educ corresponds to the range of the x axis under the confidence set,
and the projection-based CI for exper corresponds to the range of the y axis to the left of the confidence set.

. weakiv ivreg2 lwage (educ exper = fatheduc motheduc kidslt6 kidsge6), robust gridpoints(30 30) graph(k) project(_all)

Refine appearance of surface graph using replay syntax; note that with replay the levels in the graph do not have to correspond to tests reported in table

. weakiv, graph(k) surfaceopt(xlabel(0 0.1 0.2) ylabel(-0.02 0.06)) level(95 90)

As above but shaded contour graph instead of contour line graph and 3 confidence levels (95%, 90%, 80%).

. weakiv, graph(k) surfaceopt(xlabel(0 0.1 0.2) ylabel(-0.02 0.06)) level(95 90 80) contouropt(contourshade)

estadd and other miscellaneous examples

Illustrates behavior of estadd.

. ivreg2 lwage (educ exper = fatheduc motheduc kidslt6 kidsge6), rob

. weakiv, estadd

. ereturn list

. weakiv ivreg2 lwage (educ exper = fatheduc motheduc kidslt6 kidsge6), rob

. ereturn list

Illustrates behavior of displaywald.

. weakiv ivreg2 lwage (educ exper = fatheduc motheduc kidslt6 kidsge6), rob display

Saved results

weakiv saves the following in e():

Scalars

e(clr_p) CLR test p-value

e(clr_stat) CLR test statistic

e(ar_p) AR test p-value

e(ar_chi2) AR test statistic

e(k_p) K test p-value

e(k_chi2) K test statistic

e(j_p) J test p-value

e(j_chi2) J test statistic

e(kj_r) K-J test p-value

e(kwt) weight on K in K-J test

e(rk) rk statistic

e(rk_p) rk test p-value (test of underidentification)

e(wald_p) Wald test p-value

e(endo_ct) number of endogenous regressors

e(wendo_ct) number of weakly-identified endogenous

e(sendo_ct) number of strongly-identified endogenous

e(wald_chi2) Wald test statistic

e(overid) degree of overidentification

e(small) =1 if small-sample adjustments used, =0 otherwise

e(alpha) default significance level for tests

e(N) sample size

e(N_clust) number of clusters (if cluster-robust VCE used)

e(ar_level) level in percent used for AR confidence interval

e(k_level) level in percent used for K confidence interval

e(j_level) level in percent used for J confidence interval

e(kj_level) level in percent for K-J confidence interval

e(kjk_level) level in percent for K test in K-J confidence interval

e(kjk_level) level in percent for J test in K-J confidence interval

e(clr_level) level in percent used for CLR confidence interval

e(wald_level) level in percent used for Wald confidence interval

e(points) number of points in grid used to estimate confidence sets

e(clrsims) number of draws used in simulations to obtain p-values for CLR test

Macros

e(null) null hypothesis (numlist)

e(clr_cset) confidence set based on CLR test

e(ar_cset) confidence set based on AR test

e(k_cset) confidence set based on K test

e(kj_cset) confidence set based on K-J test

e(wald_cset) confidence set based on Wald test

e(pxx_yy_cset) as above, projection-based confidence set for variable xx, test yy

e(inexog) list of exogenous regressors (excluding any included in the tests)

e(tinexog) list of any exogenous regressors included in tests (testexog(.) option)

e(exexog) list of excluded instruments

e(depvar) dependent variable

e(endo) endogenous variable(s)

e(wendo) weakly-identified endogenous

e(sendo) strongly-identified endogenous

e(csendo) if subset-AR test reported, endogenous excluded from the subset

e(pwendo) endogenous vars with projection-based confidence sets

e(pwendo_nlist) corresponding numbers for e(pwendo); used to identify projection-based confidence sets in e(.) (see above)

e(gridpoints) list of grid points in each dimension

e(model) linear IV, IV probit or IV tobit

e(waldcmd) iv_command used to estimate standard IV model: ivregress, ivreg2, ivreg2h,
xtivreg, xtivreg2, xtabond2, ivprobit, or ivtobit

e(level) default confidence level in percent used for tests of null = 100*(1-alpha)

e(levellist) confidence level(s) plotted in graphs

e(method) lm or md

e(cmd) weakiv

Matrices

e(citable) table with test statistics, p-values, and rejection
indicators for every grid point over which hypotheses were tested.
If strong(.) was used, the estimated coefficients
for the strongly-identified regressors are also recorded.

e(pxxcitable) grid table with rejection indicators
for projection-based inference;
xx will be 1 or 2 numbers corresponding to the endogenous regressor(s)

e(wbeta) weakly-identified coefficients from IV model used for Wald tests

e(var_wbeta) VCV from IV model used for Wald tests

e(sbeta) if strong(.) was used, estimated strongly-identified coefficients at null

e(ebeta) Wald point estimates for full set of endogenous regressors

e(cuebeta) if cuepoint was used, CUE point estimates for full set of endogenous regressors

Acknowledgements

weakiv builds on and extends the command rivest by Finlay and Magnusson (2009).
The main differences and extensions are:
(a) extension to the multiple-endogenous-regressor case
and to subsets of weakly-identified coefficients;
(b) graphics options that allow the plotting of confidence intervals and rejection probabilities (1-endog-regressor),
and confidence regions and rejection surfaces (2-endog-regressors);
(c) support for a wider range of variance-covariance estimators in linear IV estimation;
including HAC (heteroskedastic-and autocorrelation-robust) and two-way clustering VCEs;
(d) support for a wider range of estimators, including panel data estimators;
(e) support for LM versions of the tests;
(f) support for strongly-identified coefficients, projection-based inference, and subset-AR tests;
(g) specification of models directly in the command line as well as obtaining specification from
a previously-estimated or stored model (weakiv is an eclass command);
(h) changes in terminology, syntax etc.

The code in weakiv for the closed-form solutions for confidence intervals
in the i.i.d. case (homosekdasticity and independence)
derives from condivreg by Mikusheva and Poi.

References

Anderson, T. W. and Rubin, H. 1949.
Estimation of the Parameters of Single Equation in a Complete
System of Stochastic Equations.
Annals of Mathematical Statistics 20:46–63.

Baum, C.F. and Schaffer, M.E. 2013.
AVAR: module to perform asymptotic covariance estimation for iid and
non-iid data robust to heteroskedasticity, autocorrelation, 1- and 2-way
clustering, and common cross-panel autocorrelated disturbances.
http://ideas.repec.org/c/boc/bocode/s457689.html.

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.
http://dx.doi.org/10.2139/ssrn.937943.

Chernozhukov, V. and Hansen, C. 2008.
The Reduced Form:
A Simple Approach to Inference with Weak Instruments.
Economics Letters 100(1):68-71.

Finlay, K. and Magnusson, L.M. 2009.
Implementing weak-instrument robust tests for
a general class of instrumental-variables models.
Stata Journal 9(3):398-421.
http://www.stata-journal.com/article.html?article=st0171.

Guggenberger, P., Kleibergen, F., Mavroeidis, S. and Chen, L. 2012.
On the Asymptotic Sizes of Subset Anderson–Rubin and Lagrange Multiplier Tests
in Linear Instrumental Variables Regression.
Econometrica, 80:2649-2666.

Jann, B. 2009.
ESTOUT: Stata module to make regression tables.
http://ideas.repec.org/c/boc/bocode/s439301.html.

Kleibergen, F. 2002.
Pivotal Statistics for Testing Structural Parameters in Instrumental Variables Regression.
Econometrica, 70:1781-1803.

Kleibergen, F. 2004.
Testing Subsets of Structural Parameters in the Instrumental Variables Regression Model.
Review of Economics and Statistics, 86:418-423.

Kleibergen, F. 2005.
Testing Parameters in GMM Without Assuming that They Are Identified.
Econometrica, 73:1103-1123.

Kleibergen, F. and Paap, R. 2006.
Generalized Reduced Rank Tests Using the Singular Value Decomposition.
Journal of Econometrics, 133:97-126.

Mander, A. 2005.
SURFACE: Stata module to draw a 3D wireform surface plot.
http://ideas.repec.org/c/boc/bocode/s448501.html.

Magnusson, L.M. 2010.
Inference in limited dependent variable models robust to weak identification.
Econometrics Journal, 13:S56-S79.

Mikusheva, A. 2013.
Survey on statistical inferences in weakly-identified instrumental variables models.
Applied Econometrics, 29:117-131.
http://econpapers.repec.org/article/risapltrx/0206.htm.

Moreira, M. 2003.
A Conditional Likelihood Ratio Test for Structural Models.
Econometrica, 71:1027-1048.

Mikusheva, A. and Poi, B. 2006.
Tests and confidence sets with correct size when instruments are potentially weak.
Stata Journal 6(3):335-347.
http://www.stata-journal.com/article.html?article=st0033_2.

Citation of weakiv

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

Finlay, K., Magnusson, L.M., Schaffer, M.E. 2013.
weakiv: Weak-instrument-robust tests and confidence intervals
for instrumental-variable (IV) estimation of linear, probit and tobit models.
http://ideas.repec.org/c/boc/bocode/s457684.html

Authors

Keith Finlay, Tulane University, USA
kfinlay@gmail.com

Leandro Magnusson, University of Western Australia
leandro.magnusson@uwa.edu.au

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

Also see

Article: Stata Journal, volume 11, number 2: st0171_1,

Stata Journal, volume 9, number 3: st0171

Manual: [R] ivregress,

[R] ivprobit,

[R] ivtobit,

[R] xtivreg,

[R] test

Help: condivreg, ivreg2, ivreg2h, xtivreg2, xtabond2, ranktest