Repository navigation
ENH: Fit the ADF t-test critical values to the same simulations as the p-values - #1017
Merged
Merged
Conversation
Regress every simulated quantile of the ADF t-statistic on a constant and powers of 1/nobs, where nobs = T - 1 is the number of observations in the regression, as ADF and PhillipsPerron pass to mackinnoncrit. The regressions of the 1%, 5% and 10% quantiles are the critical values, adf_t_cv_approx, as for the ADF z-test. The p-value is fit to the constants, the asymptotic quantiles, in place of the quantiles with T=2000, so the p-values of the asymptotic critical values are their sizes. estimate_response_surface refits after dropping the highest power of 1/nobs while it is insignificant, where estimate_cv_regression sets insignificant coefficients to 0 without refitting. tau_2010 is read from the file that is updated, since importing it from arch.unitroot needs the values that the script writes.
Run adf_t_simulation_process.py on 7,816 simulation files (n 1,966, c 1,954, ct 1,947, ctt 1,949; 250,000 draws each). Adds adf_t_cv_approx and refits the p-value to the asymptotic quantiles.
mackinnoncrit uses adf_t_cv_approx for the ADF t-test with one unit root, so the critical values of ADF and PhillipsPerron come from the same simulations as the p-values. With more than one unit root it still uses MacKinnon (2010). Update the ADF and mackinnoncrit docstrings and the ADF examples (0.0273 -> 0.0271, 0.0825 -> 0.0822 with trend="ct").
Check that the p-values of the asymptotic critical values are 1%, 5% and 10%, that the critical values match the simulated quantiles with 24, 99 and infinitely many observations, and that more than one unit root uses MacKinnon (2010). The p-value reference quantiles are now the asymptotic quantiles, and test_adf_no_options expects 0.027104.
The critical values with one unit root are now fit to the same simulations as the p-values, and the p-value to the asymptotic quantiles. Update the numbers for the 7,816 simulation files.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1017 +/- ##
=======================================
Coverage 99.44% 99.44%
=======================================
Files 153 153
Lines 34229 34259 +30
Branches 2591 2594 +3
=======================================
+ Hits 34039 34069 +30
Misses 114 114
Partials 76 76
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 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.
Fits the critical values of the ADF t-test with one unit root to the simulations from #997, as
adf_z_simlation_process.pydoes for the ADF z-test. The p-value is now fit to the asymptotic quantiles from the same regressions. As a result, the p-values of the asymptotic critical values are 1%, 5% and 10%.Important
The tables come from 7,816 of the 8,000 files (
n1,966,c1,954,ct1,947,ctt1,949) that were inDropbox/adf-ton 2026-11-11, while the run was still writing. When the run is complete, rerunadf_t_simulation_process.pyand update:SIMULATED_QUANTILESandSIMULATED_CRITICAL_VALUESintest_adf_t_pvalue.py;Why the critical values alone aren't enough
On main, the p-value is fit to the quantiles with T=2000. An asymptotic critical value is the constant of a regression on powers of 1/nobs, the limit as T → ∞. So the p-values of the asymptotic critical values aren't 1%, 5% and 10%, and fitting
adf_t_cv_approxalone wouldn't change that. The ADF z-test has the same problem.These are the p-values of the asymptotic 1%, 5% and 10% critical values:
ncctcttThe processing now does the following for each trend:
ADFandPhillipsPerronpass tomackinnoncrit.adf_t_cv_approx.estimate_cv_regressionsets insignificant coefficients to 0 and keeps the others as they are. Withn, that fits the 5% critical values worse than MacKinnon's: up to 22 standard errors off at small samples, against 4. The newestimate_response_surfaceinstead drops the highest power of 1/nobs while it's insignificant, then fits the regression again.Results
These compare 8.x (MacKinnon 1994 and 2010), main (#1008) and this PR. Errors are measured against the simulated asymptotic quantiles.
ncctcttcandctt. This PR fixes that.nandcis a little larger than MacKinnon's. That's the limit of a cubic above the cut-off, as in ENH: Use smooth ADF t-test p-values from the new simulations #1008.n, 1/nobs³ is dropped at all three sizes.ADFexamples change from 0.0273 to 0.0271, and from 0.0825 to 0.0822 withtrend="ct".Checks
adf_z_simlation_process.py, run after it, reproduces the file byte for byte, so it keeps the new section.test_lower_case_options.pypass (8,280).--skip-slow(31,562 passed, 812 skipped).arch.unitrootpass.Changes
estimate_response_surfaceinshared.py, used byadf_t_simulation_process.py, which now also writesadf_t_cv_approx. The script readstau_2010from the file it updates, for the comparison it prints. Importing it fromarch.unitrootfails until the file hasadf_t_cv_approx.dickey_fuller.pyregenerated.mackinnoncrit: withdist_type="adf-t"and one unit root, it usesadf_t_cv_approx. With more than one unit root, it still uses MacKinnon (2010). The docstrings ofmackinnoncritandADFand the twoADFexamples are updated.test_adf_no_optionsandtest_adf_critical_valueare updated.Not changed
estimate_cv_regression, and on main the 1/T³ terms of the 5% and 10% values withnandcare 0.ADFandPhillipsPerronpass nobs = T − 1.adf_z_simlation_process.py.🤖 Generated with Claude Code