statsmodels icon indicating copy to clipboard operation
statsmodels copied to clipboard

ENH: Segmented knots rebased

Open josef-pkt opened this issue 2 years ago • 5 comments

rebased version of #2677

removed last commit which was compat fixes for numpy < 1.9 (in percentile)

status not clear see old comments https://github.com/statsmodels/statsmodels/pull/2677#issuecomment-226978367 predict and results info incomplete or missing

old notebook https://github.com/josef-pkt/misc/blob/segmented/notebooks/ex_segmented_regression_sm.ipynb

segmented is in base get_objective needs llf as alternative to ssr then we could try a poisson or similar example

josef-pkt avatar Feb 16 '22 15:02 josef-pkt

Hello @josef-pkt! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 177:9: E306 expected 1 blank line before a nested definition, found 0

pep8speaks avatar Feb 16 '22 15:02 pep8speaks

does this use (effective) degrees of freedom corresponding to the number of segments?

josef-pkt avatar Feb 16 '22 15:02 josef-pkt

This pull request introduces 1 alert when merging a0b57b41417c8eb93c0724375e11fad344a4f0ce into 152e27dcc667a423f798810a1b0fee2f6340f73d - view on LGTM.com

new alerts:

  • 1 for Variable defined multiple times

lgtm-com[bot] avatar Feb 16 '22 15:02 lgtm-com[bot]

unit tests pass, pep-8 style failures

josef-pkt avatar Feb 16 '22 16:02 josef-pkt

not clear from a quick look at this PR:

usage for other models than OLS? The module is base/_segmented.py and seems to be designed for generically for models. However, I don't see a non-OLS example here. For OLS only, it would fit better in regression.special_model(s)

josef-pkt avatar Aug 06 '22 10:08 josef-pkt