Skip to content

SUMM/ENH: migrate pandas stats models #2745

Closed

Description

@josef-pkt

see also #2302 for MovingOLS

The models in pandas.stats have now been deprecated. pandas-dev/pandas#6077

We should add some things in statsmodels and check that we have roughly the same functionality

  • fama_macbeth: there is no equivalent in statsmodels, example and test case is in pandas issue
    MIGRATE: move stats code to statsmodels / deprecate in pandas pandas-dev/pandas#6077 (comment)
    I guess we can initially move it largely the way it is, get it to work, and refactor later if we want a more generic solution. (IIRC, I have seen similar models in other contexts.)
  • OLS obsolete, I guess we have already everything covered (and more than pandas)
  • Moving/Rolling and Expanding OLS: I haven't looked in a long time.
    Ignore and let users use generic rolling methods, or write specific code?
  • Panel data: AFAIR, pandas only has fixed effects, which is just OLS with dummies (e.g. use patsy).
    We have open issues to concentrate out the fixed effects dummies Absorbing fixed effects #2568, see also SUMM/ENH: sparse matrix support in models #2710 (sparse matrices)
    Panel robust covariance matrices need some cleanup, independently of this.
    Econometrics panel data support with two random effects is in PR. WIP: Add Panel Data models #1133
    MixedLM has more general mixed effects structure that also covers now crossed effects.
  • VAR: I guess it's covered by VAR in statsmodels, but I never compared.

Not clear: missing value handling, balanced panel structure, there might be some details or options that don't work the same way.

Activity

  1. RedPandaHat commented on Apr 21, 2016

    @RedPandaHat

    If I might throw in a vote -- we use rolling OLS a great deal, and it would be helpful to still have this available via a simple function call.

  2. josef-pkt commented on Apr 21, 2016

    @josef-pkt
    MemberAuthor

    @RedPandaHat votes and usecases are useful for the design.
    AFAIU, the simplest case would just be a loop using pandas rolling_apply.

    My two main design question (I haven't looked yet), are

    • what do we need to keep from each regression.
    • how much special code should we add to speed up the calculations.

    and related to speed:

    • some faster methods will be numerically less stable than the full OLS estimate in each window.
      Is trading off numerical precision in "not nice" problems for increase speed worth the effort?

    related design for recursive (expanding) ols using the new statespace models is also still a bit open #2830

  3. Liam3851 commented on Aug 23, 2016

    @Liam3851

    Adding another vote. pandas' implementation doesn't appear at a glance to incredibly optimized (much of the rolling code is in Python, not Cython, for example), but nonetheless the rolling implementation is about 50x faster than running the individual regressions in statsmodels currently.

  4. added 14 commits that reference this issue on Jul 28, 2019
    9b0daf9
    42eb005
    fda12b6
    07cab65
    2393f2f
    437f610
    3164b29
    dcad05b
    ee662e6
    79958cd
    3b32961
    592e64b
    fa0c54c
    82377ac
  5. added this to the 0.11 milestone on Dec 18, 2019
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions