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: function to compute smoothed state weights (observations and prior mean) for state space models #8013

Merged
merged 5 commits into from
Jan 13, 2022

Conversation

ChadFulton
Copy link
Member

@ChadFulton ChadFulton commented Jan 12, 2022

  • tests added / passed.
  • code/documentation is well formatted.
  • properly formatted commit message.

In state space models, the estimates of the state vector (and a number of other quantities) can be written as a weighted vector sum of the observations (see Durbin and Koopman, 2012, section 4.8) and the prior mean ("initial state"). This PR adds a function to compute the weights for the smoothed state vector, which can be useful in a variety of ways (e.g. decomposing estimates of the unobserved components, or computing leverage statistics, etc.).

Two other notes:

  • While the main function here is in Cython for performance, the original commit contains an implementation in Python. This is removed in the second commit to avoid zombie code, while the Git history will still have the Python implementation.
  • Although I think these weights are typically the most useful, this function could be easily expanded to compute e.g. weights for the predicted or filtered state vector.

@pep8speaks
Copy link

pep8speaks commented Jan 12, 2022

Hello @ChadFulton! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2022-01-13 02:54:22 UTC

@ChadFulton ChadFulton changed the title ENH: function to compute smoothed state observation weights for state space models ENH: function to compute smoothed state weights (observations and prior mean) for state space models Jan 12, 2022
@ChadFulton ChadFulton merged commit 126a567 into statsmodels:main Jan 13, 2022
@ChadFulton ChadFulton deleted the ss-weights branch January 13, 2022 03:37
@bashtage bashtage added this to the 0.14 milestone Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants