Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Add plot_states and Pandas filtered state functions to MLEModel #4182

Open
jengelman opened this issue Dec 27, 2017 · 4 comments
Open
Assignees

Comments

@jengelman
Copy link

jengelman commented Dec 27, 2017

A common part of post-estimation work for statespace models is looking at how the state variable means/variances change over time. Both UnobservedComponents and RecursiveLS have really nice helper functions for plotting state means. It'd be great to get something similar for SARIMAX, VARMAX, et al and custom models without having to subclass all of them, by adding this to MLEModel. Additionally, functions that return the filtered states and state covariances in Pandas dataframes would be really convenient.

As far as I can tell, this could be done by reusing the existing code from RecursiveLS and a bit of refactoring for the existing two models. Happy to submit a PR for either or both parts of this if there aren't further complications I'm not aware of.

@jengelman jengelman changed the title Add plot_states and get_filtered_states/get_smoothed_states functions to MLEModel Add plot_states and Pandas filtered state functions to MLEModel Dec 27, 2017
@ChadFulton
Copy link
Member

ChadFulton commented Dec 27, 2017 via email

@jengelman
Copy link
Author

jengelman commented Dec 27, 2017

@ChadFulton For autoregressive or lag coefficients in in VARMAX and SARIMAX, it'd be nice to be able to visually check for changes in the "strength" of relationships without breaks_cusumolsresid (which doesn't show you the changepoints) or recursively running acorr_ljungbox on every set of residuals. I agree that it's a little bit less interpretable than level, trend, etc, but it's not really any less so than whatever endog used in RecursiveLS. Maybe plot functions could take an optional mapping from coefficients to display names in case people want to customize the displays.

For the second point, a multiindex sounds great for covariances.

Edit: somewhat related, just noticed VECM doesn't expose filtered_states etc at all (despite having the filtered probability plot function)

@jengelman
Copy link
Author

Just noticed that the Markov models/results, which also doesn't expose filtered state (just probabilities) don't inherit from the MLE equivalents. Are you planning on changing that down the road, or keeping them separate?

@ChadFulton
Copy link
Member

(My mistake on closing, hit the wrong button)

Just noticed that the Markov models/results, which also doesn't expose filtered state (just probabilities) don't inherit from the MLE equivalents. Are you planning on changing that down the road, or keeping them separate?

The Markov models aren't linear Gaussian state space models, so in general I don't think it would be useful to extend statespace.MLEModel, although perhaps some of the functionality in the latter should be placed into a Mixin, if it is also useful / valid in the Markov model case.

@ChadFulton ChadFulton self-assigned this Feb 7, 2018
@ChadFulton ChadFulton changed the title Add plot_states and Pandas filtered state functions to MLEModel ENH: Add plot_states and Pandas filtered state functions to MLEModel Feb 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants