Conversation
Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com>
…an interval logic Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com>
Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com>
…/numeric CI, unified API Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com>
Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com>
* pass correct argument to calculate test * improve argument passing and modify the ci argument to take "numeric" * set ci to false when there is more than one endo var Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Refine doc Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * remove compute_ci * use vcov_arg_to_pass Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * set ci to false when conditions are not met Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Initial plan * Add weights support to exact AR CI calculation Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com> * Add tests for weighted AR CI calculation Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com> * Address code review feedback: fix comment and use object$weights Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com>
* Initial plan * Update ar_test tests to use realistic DGP validated against ivmodel package Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com> * Fix test 2 * Fix up to tests 6 and 7
36a51be to
eb945e5
Compare
|
Happy to spend a few hours reviewing this code, but could you first create a small working example showing this matches the results from Also related to #593 |
Hi @kylebutts . During my internal testing, I benchmarked it against both ivmodel and ivDiag. However, I believe that ivDiag lacks precision: for when a closed form solution is possible (iid se with no fixed effects), ivmodel (which has an exact solution algorithm) and my PR's exact and numeric solution yield same results, but ivDiag yields a different one. I will present a reproducible example shortly My PR is superior to
|
|
Here's a simple repex: |
Fix obs_selection handling in AR test functions * Initial plan * Apply obs_selection filtering in .ar_test_core and .ar_ci_exact_iid Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com> * pass weights to feols
|
@kylebutts Just realized I have probably seen you in Positron discussions? It's nice to see you in another repo again. I'm also interested in adding valid t-ratio inference from by Lee et al. (2022) and Montiel Olea & |
|
Hi @kv9898 and thanks for this PR! |
|
I'm working through the code and have some changes I'll commit to this branch when I finish. I agree with @lrberge that we should think more about how users would use this. On the one-hand, we form a p-value or a confidence interval for the endogenous variable. We could imagine plugging in AR-based p-value or CI in that row of the regression table. Would it make sense to have a different kind of CI for the endogenous variable only? Alternatively, it could be treated similar to the other What do we think? |
Without having looked at the code, this would have been my first inclination. |
+1! Full integration with streamlined user experience needs to be thought carefully. |
|
@kylebutts Happy New Year! Any updates? |
|
Hi @kv9898, to do it correctly it actually implies big and well thought internal changes. I'm sorry but this won't be direct. I beg for your patience. |
Ohh I thought we were just planning for some nice wrappers around the function. No rush, take your time! Thanks for the quick reply, though. |
This pull request adds support for the Anderson-Rubin (AR) weak-instrument robust test for instrumental variable (IV) models in the
fixestpackage. It introduces two new functions,ar_test()andar_confint(), along with their print methods, and includes comprehensive tests to ensure correct behavior across a variety of scenarios.This is requested as part of #442.
New IV Robustness Features:
ar_test()function, which provides weak-instrument robust inference for coefficients of endogenous regressors. The relatedar_confint()function computes AR confidence intervals by inverting the test.ar_testandar_confintfunctions in theNAMESPACEto make them available for users.fixest_arandfixest_ar_confintin theNAMESPACE.Testing and Validation:
tests/fixest_tests.R, covering correct output structure, distribution selection, error handling for invalid input, and integration with model features like clustering, weights, and multiple instruments.