-
Notifications
You must be signed in to change notification settings - Fork 75
Draft (new feature) : Model to estimate when a intervention had effect #480
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
base: main
Are you sure you want to change the base?
Draft (new feature) : Model to estimate when a intervention had effect #480
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #480 +/- ##
==========================================
- Coverage 94.67% 93.23% -1.44%
==========================================
Files 32 32
Lines 2196 2233 +37
==========================================
+ Hits 2079 2082 +3
- Misses 117 151 +34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…over intervention's distributions
b7b91de
to
ee701f2
Compare
NoteIn my last PR, I added functionality allowing users to specify priors for the effect of the intervention. This provides more flexibility for Bayesian modeling and allows users to incorporate domain knowledge directly into the inference process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @JeanVanDyk. I'm very excited about the new addition, thanks for putting it together. Bear with me if I'm sometimes slow to reply - busy dad life!
At this point, could I request that you put together an ipynb
file that showcases the functionality. I'm assuming this PR will evolve and go through a couple of iterations, so this notebook will end up being a new docs page to help users understand the new functionality. If you edit the ./docs/source/notebooks/index.md
file, you can add the notebook name under the interrupted time series section. That way the notebook will render if you either build the docs locally, but it should also render in the remote docs preview build.
Did you still want feedback on the GitHub Discussion at this point?
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Simplified
|
New Feature:
InterventionTimeEstimator
for Unknown Treatment TimingThis PR introduces a new model,
InterventionTimeEstimator
, designed to estimate when an intervention has an effect in a time series — especially in cases where the exact treatment time is unknown.Use Case
This addition gives users a flexible, Bayesian approach to model treatment timing uncertainty directly within the CausalPy framework.
Notes / Open Questions
Where should this model fit into the CausalPy workflow?
I’m unsure whether
InterventionTimeEstimator
should be integrated within theInterruptedTimeSeries
(ITS) feature, or used as a standalone tool.This affects how a user-defined model could be supported.
Depending on the intended usage, I can propose a solution to allow users to inject their own custom models.
Custom model usage — base vs. intervention
Should users be able to:
Covariates
I considered adding time-varying covariates to improve the fit. Would that be useful or out of scope?
Multivariate Time Series
It's relatively easy to extend the model for multivariate input. Let me know if this is something you'd like to see.
Model Summary
Inputs:
t
: 1D array of time pointsy
: 1D array of observed valuesspan
: restricts the window for switchpoint detectioncoords
: can includeseasons
for modeling periodic effectseffect
: list of components, e.g."trend"
,"level"
,"impulse"
grain_season
: number of time steps per seasonModel Components:
intercept + trend + seasonal
effect
componentsFeel free to share any feedback or suggestions! I'm happy to refine the model or explore extensions based on your input.
📚 Documentation preview 📚: https://causalpy--480.org.readthedocs.build/en/480/