You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As per #2775 and #2749, the number of lags to be used for the test are currently either set by the user, or selected by a rule of thumb (Schwert, 1989). adfuller has the option to select them via an information criterion, maybe we should allow something similar in kpss as well?
The current warning message for an out-of-bounds p-value is displayed only once (Python default), and is of type UserWarning. Should we set it to be raised every time instead? What would be an appropriate warning type?
Leaving this here for future reference, as discussed in the PRs.
Do you know of references about which method is recommended or usually used for automatic lag selection?
AFAIU:
Because lag is only used for the HAC Newey/West variance estimation, this will be different from what is currently in autolag used by adfuller which selects the AR lag in a regression.
@josef-pkt, stats.SE provides a lot of references that may be worth looking into when I find the time for it:
In the classic Newey & West (1987, Econometrica) paper, they only consider the growth rate of this lag length parameter. Some implementations do use lag selection heuristics based on this growth rate, though. A proper nonparametric lag selection procedure is introduced Newey & West (1994, Review of Economic Studies). Alternatively, there are parametric bandwidth selection procedures (based on AR(1) or ARMA(1,1) approximations) that can also be employed - suggested by Andrews (1991, Econometrica) and refined by Andrews & Monahan (1992, Econometrica).
I have never looked into lag selection procedures for Newey-West estimators, so this is definitely something I would have to read up on.
changed the title [-]ENH: Automatic lag selection in KPSS test and appropriate warning message[/-][+]ENH: Automatic lag selection in KPSS test[/+]on Feb 14, 2017
@josef-pkt - I enjoyed the White + Zivot-Andrews project so was looking for some bite-sized open issues and this one caught my eye. I can provide an implementation for the Hobijn (Newey-West/Andrews) auto bandwidth method if there is interest here. It has been verified against SAS 9.3 and I can provide a number of test cases.
Hobijn, B., Frances, B.H., and Ooms, M. (2004). Generalizations of the KPSS-test for stationarity. Statistica Neerlandica, 52: 483-502.
This was a straightforward enhancement I will submit a PR in the next day or two. As an example of why this is important, I attached a chart showing the finite-sample (<200 obs) size distortion using both the Schwert rule-of-thumb and the Hobijn autolag method. While the Hobijn method still shows significant size distortion it is significantly better than the Schwert method. Unfortunately KPSS test is not well-behaved at very small samples (<50 obs) where a lot of our models reside. As a matter of fact, the size distortion at 25 samples is still 15% with no lags...and as the chart shows, size distortion is almost 100% using Schwert at 25 samples!
Activity
josef-pkt commentedon Jan 20, 2016
Do you know of references about which method is recommended or usually used for automatic lag selection?
AFAIU:
Because lag is only used for the HAC Newey/West variance estimation, this will be different from what is currently in
autolagused by adfuller which selects the AR lag in a regression.N-Wouda commentedon Jan 20, 2016
@josef-pkt, stats.SE provides a lot of references that may be worth looking into when I find the time for it:
I have never looked into lag selection procedures for Newey-West estimators, so this is definitely something I would have to read up on.
CLN: Replace UserWarnings with meaningful warning
CLN: Replace UserWarnings with meaningful warning
[-]ENH: Automatic lag selection in KPSS test and appropriate warning message[/-][+]ENH: Automatic lag selection in KPSS test[/+]JimVaranelli commentedon Feb 22, 2019
@josef-pkt - I enjoyed the White + Zivot-Andrews project so was looking for some bite-sized open issues and this one caught my eye. I can provide an implementation for the Hobijn (Newey-West/Andrews) auto bandwidth method if there is interest here. It has been verified against SAS 9.3 and I can provide a number of test cases.
Hobijn, B., Frances, B.H., and Ooms, M. (2004). Generalizations of the KPSS-test for stationarity. Statistica Neerlandica, 52: 483-502.
JimVaranelli commentedon Feb 27, 2019
This was a straightforward enhancement I will submit a PR in the next day or two. As an example of why this is important, I attached a chart showing the finite-sample (<200 obs) size distortion using both the Schwert rule-of-thumb and the Hobijn autolag method. While the Hobijn method still shows significant size distortion it is significantly better than the Schwert method. Unfortunately KPSS test is not well-behaved at very small samples (<50 obs) where a lot of our models reside. As a matter of fact, the size distortion at 25 samples is still 15% with no lags...and as the chart shows, size distortion is almost 100% using Schwert at 25 samples!
JimVaranelli commentedon Mar 5, 2019
Please see implementation at my github: https://github.com/JimVaranelli/KPSS-autolag. It uses 5 unit tests from the statsmodels.datasets which were verified against SAS 9.3.
JimVaranelli commentedon Mar 6, 2019
Submitted PR: #5522