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

UnobservedComponents: time-varying regression coefficients #6065

Open
mysterious-ben opened this issue Aug 3, 2019 · 4 comments
Open

UnobservedComponents: time-varying regression coefficients #6065

mysterious-ben opened this issue Aug 3, 2019 · 4 comments

Comments

@mysterious-ben
Copy link

It is impossible to specify state disturbance variances for exogeneous regressors in UnobservedComponents (passed by exog parameter). Currently, coefficients of exogeneous parameters can only be computed using least squares (mle_regression=True) or recursive least squares (mle_regression=False).

It would be great to have an option for time-varying regression coefficients. To do this, we need to associate disturbance variables to exogeneous regressors:

It can be done by addining an additional flag (e.g., time_varying_regression) to UnobservedComponents constructor. If the flag is True, regression coefficients are added to the state vector; at the same time, the same number of state disturbances is added (state disturbances are stored in self.parameters_state_cov, if I'm not mistaken). The resulting Kalman filter will be very similar to the one constructed with mle_regression=False. This solution should only require a moderate effort.

Time-varying regression coefficients are briefly mentioned in the section 6.2.1. of Time Series Anaylysis by State Space Methods (J. Durbin, S. J. Koopman).

@ChadFulton
Copy link
Member

This is a design question. We have support for time-varying regression in SARIMAX, but we can't support all variations of all state space models in each model class. The best long-term solution would be to allow composing multiple models together, but we don't have a framework for that yet.

@mysterious-ben
Copy link
Author

I think it makes sense. I guess two points in favor of adding this option availabe to UnobservedComponents would be:

  1. This option is already available in another model - SARIMAX
  2. This case is fairly common (I can't prove the latter point but pretty much everytime I was using this model I wanted to add some regressors with time-varying coefficients)

In the meanwhile, are there any code examples that would help me to subclass UnobservedComponents to add regressors with time-varying coefficients?

@ChadFulton ChadFulton self-assigned this Aug 27, 2019
@prathak
Copy link

prathak commented Jun 23, 2020

I have the same doubt, how did you solve it?

@mysterious-ben
Copy link
Author

I haven't: I wanted to do it a few times but just never found time. I think the only way would be to tweak the class UnobservedComponents, maybe using implementation of time-varying coefficients in SARIMAX as inspiration.

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

3 participants