Skip to content

Wold Representation - #3992

Closed
jbrockmendel wants to merge 5 commits into
statsmodels:masterfrom
jbrockmendel:wold
Closed

jbrockmendel wants to merge 5 commits into
statsmodels:masterfrom
jbrockmendel:wold

Conversation

@jbrockmendel

Copy link
Copy Markdown
Contributor

The various methods/attributes in the AR/ARMA/ARIMA/VAR/... classes can be segmented based on what information is necessary in order to implement them. e.g.:

aic? --> needs degrees of freedom --> needs sample size
forecast_cov --> needs correlation structure of shocks (i.e. sigma_u)
mean --> only needs intercepts and coefs

The idea behind tsa.wold is to separate out (and unify, and de-duplicate, and test) the subset of attributes/methods that depend only on the non-stochastic Wold representation of AR/ARMA/...

Fairly thorough (self-contained) tests, none of which are smoke tests.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.04%) to 81.697% when pulling 795bae4 on jbrockmendel:wold into ad70c62 on statsmodels:master.

@josef-pkt

Copy link
Copy Markdown
Member

This pull request introduces 2 alerts and fixes 3 - view on lgtm.com

new alerts:

  • 1 for eq not overridden when adding attributes
  • 1 for Inconsistent equality and hashing

fixed alerts:

  • 2 for Redundant assignment
  • 1 for Missing call to init during object initialization

Comment posted by lgtm.com

@ChadFulton

Copy link
Copy Markdown
Member

From a brief look this looks pretty reasonable to me. Is this some / mostly / all reorganization? How much of this is new?

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

Is this some / mostly / all reorganization?

Mostly. The main points are:

  1. this is to my taste "the right" level of abstraction for these classes and

  2. it is a subset of code and tests that:
    a) I have gone over fairly carefully, whereas large portions of non-statespace tsa are relatively unmaintained (discussed in REF: deprecate ARMA/ARIMA in favor of SARIMAX ? #3884).
    b) Is mostly self-contained, so can be thoroughly tested in isolation.

I think there is a non-trivial change that I should revert that returns empty arrays instead of np.nan for arfreq and mafreq.

There are a couple of TODO notes that could use a look from a fresh pair of eyes:

  1. In arroots and maroots there's a question about whether the docstrings should say """Roots of lag-polynomial""" or """Inverse of roots of lag-polynomial"""
  2. The normalization by sqrt(2pi) in arma_periodogram needs checking/a reference. There's a note in the docstring asking for a reference.

@josef-pkt

Copy link
Copy Markdown
Member

Note #3482 arima process recently got a cleanup and better unit test coverage

@josef-pkt

Copy link
Copy Markdown
Member

very superficial skimming only

parts are fine but overall I'm vaguely skeptical. Mainly this adds an additional layer and module, with what was mainly supposed to be covered by the ARMA and VAR process classes.
Some common structure between models can be separated out, but my first impression is that this makes it more difficult to figure out what various models are or should be doing.

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

@josef-pkt

Mainly this adds an additional layer and module

The non-stochastic representation is a layer that is already present in AR/ARMA/ARIMA/VAR/SVAR/... De-duplicating them reduces the amount of code to maintain, makes it easier to maintain internal consistency, and clarifies the relationships between them. Moreover, because this is a carefully-thought-out level of abstraction, it is almost entirely independent of other layers, so can be thoroughly tested in isolation of those other layers.

You want to finally bury test_arima111_predict_exog_2127 #3980 once and for all? So do I. So let's isolate the problem by testing the ever-loving shit out of the building blocks. Using teamwork!

I'm pretty frustrated by what I perceive to be an inconsistency between "My main criterion for code style and cleanliness is how long it takes me to understand a piece of code" and an unwillingness to consider/allow/delegate incremental improvements specifically tailored to be be trivially-verifiable. On the flip side, it was only a few weeks ago that someone was saying that ar_model/arma_model/... are basically un-maintained and gee wouldn't it be nice if someone stepped up to take responsibility for them (not to mention varma_process/arme_mle/...).

Not interested in going in circles on this. Closing.

@josef-pkt

Copy link
Copy Markdown
Member

This pull request introduces 2 alerts and fixes 3 - view on lgtm.com

new alerts:

  • 1 for eq not overridden when adding attributes
  • 1 for Inconsistent equality and hashing

fixed alerts:

  • 2 for Redundant assignment
  • 1 for Missing call to init during object initialization

Comment posted by lgtm.com

@jbrockmendel jbrockmendel mentioned this pull request Oct 7, 2017
@josef-pkt

Copy link
Copy Markdown
Member

someone was saying that ar_model/arma_model/... are basically un-maintained

If you can show me how it help closing existing bugs, then I'm much more interested in reviewing it. For example based on the number of open issues, problems and missing support, I think ARIMA/... predict needs a refactoring that might help to fix and close several bugs, and make the code easier to understand.
I'm also sure that there are several post-estimation hypothesis or specification test that can be put into a central place that then can be reused by ARIMA (unit variate versions) VAR (multivariate versions) and statespace models that need both.

this is to my taste "the right" level of abstraction for these classes

My/our thinking (years ago) was that estimation class - results class - process class was the right level of abstraction, with delegation between the three, and some outsourced functionality and specials like IRFAnalysis.

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

If you can show me how it help closing existing bugs

Paying down technical debt is about pre-empting problems. If done right it should make the higher-priority issues you mentioned easier to address.

@jbrockmendel
jbrockmendel deleted the wold branch October 8, 2017 01:34
@jbrockmendel jbrockmendel mentioned this pull request Oct 17, 2017
@bashtage bashtage added the rejected Used for PRs with changes that are not acceptable label Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rejected Used for PRs with changes that are not acceptable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants