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)
iv_model <- ivreg(y ~ x | z1 + z2, data = data)
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.