weakTest | R Documentation |
This is a collection of tests for weak instruments. It includes the Cragg and Donald test for the reduced rank hypothesis, the conditional F-test of Sanderson and Windmeijer (2016), the robust effective F test of Montiel Olea and Pflueger (2013) and the Lewis and Mertens (2022) robust test with multiple endogenous variables. The critical values of Stock and Yogo (2005) for the null hypothesis of weak instruments are also provided.
SWtest(object, j=1, print=TRUE, ...)
CDtest(object, print=TRUE, SWcrit=FALSE, ...)
MOPtest(object, tau=0.10, size=0.05, print=TRUE,
estMethod = c("TSLS", "LIML"), simplified = TRUE,
digits = max(3L, getOption("digits") - 3L), ...)
LewMertest(object, tau=0.10, size=0.05, print=TRUE,
simplified = TRUE, digits = max(3L, getOption("digits") -
3L), npoints=10, ...)
SYTables(object, print=TRUE, SWcrit=FALSE)
object |
A model of class |
j |
The Sanderson and Windmeijer test is based on the regression
of |
tau |
The desired bias. |
size |
The size of the test for the critical value. |
estMethod |
Which method we want to test the weak instruments for? The method determined the critical value associated with a given relative bias. |
simplified |
Should we perform the simplified test? The test produce more conservative critical values. The generalized test is computationally more demanding. |
print |
If |
digits |
The number of digits to print when |
SWcrit |
If true, the critical values and the test are ajusted to Sanderson and Windmeijer (2016). See details. |
npoints |
The number of minimizations to run in order to find the
global minimum, which is used for the Lewis and Mertens critical
value. It affects the results only when |
... |
Arguments passed to |
The CDtest
function computes the test for the model
object and runs SYTables
to extract the critical values that are
specific to the model.
Let l
be the number of included endogenous variables and s
be the number of excluded exogenous. The Stock and Yogo (2005) tables
are based on these two values and they are only available for
l=1,2
and s=1,...,30
. For the SW test, which is only
defined for $l>1$, we compare the statistic with the critical values
associated with l=l-1
and s=s-l+1
. These are the critical
values that are returned when the argument SWcrit
of
SYTables
is set to TRUE
. This allows us to test for weak
instruments in models with 2 or 3 included endogenous variable using
the same tables of critical values.
Sanderson and Windmeijer (2016) show that we can use the same critical
values if we modify the CD test by multiplying it by s/(s-l+1)
,
which is what the function CDtest
returns if the argument
SWcrit
is set to TRUE
.
The function CDtest
returns the Cragg anb Donald statistic when
print
is set to FALSE
.
The function SYTable
returns a list with the following elements
when print
is set to FALSE
:
biasTSLS , biasFuller |
Named vectors of critical values for TSLS
or Fuller (see |
sizeTSLS , sizeLIML |
A named vector of critical values for TSLS
or LIML (see |
Both functions return NULL
invisibly when print
is set to
TRUE
data(simData)
theta <- c(beta0=1,beta1=2)
model1 <- momentModel(y~x1, ~z1+z2, data=simData)
CDtest(model1)
model2 <- momentModel(y~y1+y2+x1, ~z1+z2+z3+z4+x1, data=simData)
SWtest(model2, 1, FALSE)
SWtest(model2, 2, FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.