Repository navigation
Conversation
…imators Add bandwidth_method to the kernel covariance estimators and to PreWhitenedRecolored. The default, "newey-west", is the existing automatic bandwidth and is unchanged. "andrews" selects the bandwidth using the AR(1) plug-in estimate of alpha(q) in Section 6 of Andrews (1991), eqs. (6.3)-(6.4), with the kernel constants and exponent q of each kernel. The AR(1) is fit to each column by OLS with an intercept, as in sandwich::bwAndrews, which the tests match. xref #887
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #964 +/- ##
========================================
Coverage 98.95% 98.95%
========================================
Files 136 137 +1
Lines 30043 30334 +291
Branches 2331 2345 +14
========================================
+ Hits 29729 30018 +289
- Misses 256 257 +1
- Partials 58 59 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Target 9.1: merge after v9.0.0 is tagged. Closes #887.
Adds
bandwidth_method="newey-west" | "andrews"to every kernel covariance estimator(including the Andrews, Gallant, NeweyWest and ZeroLag aliases) and to
PreWhitenedRecolored, which passes it to its kernel.bandwidth_methodproperty."newey-west"is the default and is unchanged: the bandwidths and long-run sums arebit-identical to main on 12 kernels.
"andrews"implements Andrews (1991, Section 6, eqs. 6.3-6.4).as R's
ar(method="ols")does.c_k (alpha(q) T)^(1/(2q+1)). arch's existing kernel constants arealready Andrews' constants (Bartlett 1.1447, Parzen 2.6614, QS 1.3221, Tukey-Hanning
1.7462), and the derivation reproduces them.
bandwidthoverrides the method.force_intand thenobs - 1cap workas before.
Validation: R 4.6.1 with sandwich 3.1.3,
bwAndrews(x, kernel=..., approx="AR(1)", weights=w, prewhite=FALSE).non-uniform and zero weights) × 4 kernels ×
center.as constants.
independent least-squares reference.
Tests:
arch/tests/covariance/test_andrews_bandwidth.py, 153 tests.numpydoc lint 0, and the docs build has no new warnings.
For review:
kernel_constis 1.8576, but the formula gives 1.8587 (0.06%). It isleft unchanged, since changing it would alter the default bandwidth; the test tolerates
the difference.
bandwidth_method="andrews"for its long-run variance. Thatbelongs in a separate issue.
Thanks to @ZacKienzle2 for the proposal.
🤖 Generated with Claude Code