Skip to content

ENH: Automatic lag selection in KPSS test #2781

Closed

Description

@N-Wouda

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.

Activity

  1. josef-pkt commented on Jan 20, 2016

    @josef-pkt
    Member

    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.

  2. N-Wouda commented on Jan 20, 2016

    @N-Wouda
    ContributorAuthor

    @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.

  3. 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
  4. JimVaranelli commented on Feb 22, 2019

    @JimVaranelli
    Contributor

    @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.

  5. JimVaranelli commented on Feb 27, 2019

    @JimVaranelli
    Contributor

    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!

    kpsslags

  6. JimVaranelli commented on Mar 5, 2019

    @JimVaranelli
    Contributor

    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.

  7. JimVaranelli commented on Mar 6, 2019

    @JimVaranelli
    Contributor

    Submitted PR: #5522

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions