Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To obtain a weak instrument test for instrument variables in modelsummary using R, you can use the "summary_iv()" function from the "ivmodel" package. This function calculates the Sargan-Hansen test for weak instrument validity.

Here's an example code:

```{r} library(ivmodel)

specify your instrumental variable model

iv_model <- ivreg(y ~ x | z1 + z2, data = data)

calculate weak instrument test using summary_iv function

summaryiv(ivmodel) ```

The output will show you the Sargan-Hansen test statistic and its associated p-value. If the p-value is less than your chosen significance level (e.g. 0.05), then you can reject the null hypothesis of no weak instrument problem. If the p-value is greater than your chosen significance level, you cannot reject the null hypothesis and there is no evidence of a weak instrument problem.