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

ITS: add Bayesian Structural Timeseries model #52

Open
drbenvincent opened this issue Nov 10, 2022 · 11 comments
Open

ITS: add Bayesian Structural Timeseries model #52

drbenvincent opened this issue Nov 10, 2022 · 11 comments
Labels
enhancement New feature or request

Comments

@drbenvincent
Copy link
Collaborator

drbenvincent commented Nov 10, 2022

@drbenvincent drbenvincent added the enhancement New feature or request label Dec 5, 2022
@NathanielF
Copy link
Contributor

What were you thinking for this? MVP using jax? Or waiting for a PYMC implementation?

@drbenvincent
Copy link
Collaborator Author

See #116

A pymc implementation would be great, but unsure of the timescale on that. So JAX wrapper seems like the quickest thing. Not sure if @juanitorduz had plans to work on this. But I think we'd be very happy if you wanted to work on it

@NathanielF
Copy link
Contributor

NathanielF commented Jan 11, 2023

That'd be cool! If there is no objection from. @juanitorduz I'll look into your contribution guide this weekend. Not sure how quick i can be on this, but from a cursory look allot of the heavy lifting seems done already.

@juanitorduz
Copy link
Collaborator

juanitorduz commented Jan 11, 2023

Hey! I'm just starting exploring the sts-jax library so feel free to start working on it! I guess we are open regarding the library and framework for a first iteration. I will try to catch up! 🙂 !

@juanitorduz
Copy link
Collaborator

Also, check out this project: https://github.com/jamalsenouci/causalimpact uses both statsmodels and pymc

@drbenvincent
Copy link
Collaborator Author

That'd be cool! If there is no objection from. @juanitorduz I'll look into your contribution guide this weekend. Not sure how quick i can be on this, but from a cursory look allot of the heavy lifting seems done already.

Sounds good. Just let me know if you need any pointers. There is a guide there, but we aren't open for general contributors yet, so it's not battle tested.

@NathanielF
Copy link
Contributor

Sorry haven't found the time to look at this properly. Trying to get more into jax following Ravin's book club on Dynamax... but honestly not sure when i'll get to this.

@drbenvincent
Copy link
Collaborator Author

Just dropping in a link to the developments on state space models by @jessegrabowski here https://discourse.pymc.io/t/state-space-models-in-pymc/9146

@drbenvincent
Copy link
Collaborator Author

Tagging @cetagostini

@jessegrabowski
Copy link

jessegrabowski commented Dec 23, 2023

How do people do causality in STS framework? I'm interested in bringing more tools related to this into what we've already got in the statespace module. I know about granger test and rotated (cholesky decomposed) IRFs, but is there more? Also does the granger test make sense in a Bayesian framework? It always struck me as a glorified t-test.

@drbenvincent
Copy link
Collaborator Author

It would be great to get your input @jessegrabowski. The causal side of things is rich, but possibly the most direct way of working out how time series approaches are used in causality would be to look at Interrupted Time Series:

These examples take the simplistic "linear regression as time series" approach. The next step (which CausalImpact uses) is to Bayesian structural time-series models.

It should be relatively trivial to plug that into CausalPy. We'd just need to adapt the pymc_models.LinearRegression class so that the build_model factory function returns a time series model. Ideally we'd retain the same kind of Wilkinson notation model formula to provide predictor variables, but it's not the end of the world if a slightly different API is needed.

Could be wrong, but I think it's the kind of thing that we could get done in 1 (or just a few) pair coding sessions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants