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: state space: compute smoothed state autocovariance matrices for arbitrary lags #6579

Merged
merged 6 commits into from
Mar 29, 2020

Conversation

ChadFulton
Copy link
Member

@ChadFulton ChadFulton commented Mar 12, 2020

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

We already compute the lag=1 smoothed autocovariance matrix for the state vector (i.e. Cov(t, t-1)) in the Cython recursions (because it is required for the EM algorithm applied to the transition equation, and so it's best if it's pretty fast).

This PR adds a new smoothed_state_autocovariance method to the SmootherResults class to allow computing autocovariances with any lag = 0, +-1, +-2, .... One application of this is computing the "news" for nowcasting models, described in Banbura and Modugo (2014). Not in Cython since as far as I know, this is just for postestimation results, and won't be in an inner loop.

@codecov
Copy link

codecov bot commented Mar 12, 2020

Codecov Report

Merging #6579 into master will increase coverage by 0.02%.
The diff coverage is 93.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6579      +/-   ##
==========================================
+ Coverage   85.28%   85.31%   +0.02%     
==========================================
  Files         646      646              
  Lines      103651   103922     +271     
  Branches    11270    11311      +41     
==========================================
+ Hits        88401    88657     +256     
- Misses      12797    12806       +9     
- Partials     2453     2459       +6
Impacted Files Coverage Δ
statsmodels/tsa/statespace/tests/test_smoothing.py 98.83% <100%> (+0.5%) ⬆️
...els/tsa/statespace/tests/test_impulse_responses.py 100% <100%> (ø) ⬆️
statsmodels/tsa/statespace/kalman_smoother.py 86.09% <76.54%> (-3.1%) ⬇️
statsmodels/tsa/statespace/representation.py 88.13% <0%> (+0.56%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3c74781...37272a4. Read the comment docs.

@ChadFulton
Copy link
Member Author

Squashed.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 87.661% when pulling 0b85a4d on ChadFulton:ss-acov-lgt1 into c0e585d on statsmodels:master.

@coveralls
Copy link

coveralls commented Mar 16, 2020

Coverage Status

Coverage increased (+0.01%) to 87.674% when pulling 37272a4 on ChadFulton:ss-acov-lgt1 into 3c74781 on statsmodels:master.

@ChadFulton
Copy link
Member Author

Also, this is still a semi-private method, since this PR only puts a new method in SmootherResults and doesn't make it available as a method in MLEResults, which I think is good to start with.

@ChadFulton ChadFulton merged commit c0b5d39 into statsmodels:master Mar 29, 2020
@ChadFulton ChadFulton deleted the ss-acov-lgt1 branch March 29, 2020 01:34
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.

2 participants