You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment we only have one example of using splines in CausalPy, and that's in a non-Bayesian example of the regression discontinuity design.
I would be interesting to see splines used more, particular in a Bayesian notebook. The easiest way to do this would be to extend the existing Excess deaths due to COVID-19 notebook example which just has a basic linear trend. For example, we could modify the equation to standardize(deaths) ~ 0 + cr(t, df=6) + C(month) + temp to model the trend with a natural cubic spline.
I did give that a quick go, and was able to get a better pre-treatment fit ($R^2=0.75$) than the linear trend model ($R^2=0.71$), however there were $\hat{R}$ convergence problems. This could be also be related to the mismatch between the scale of the data and the (not cleverly chosen priors), and that is what probably lead me to use the standardize function in the patsy model formula. One solution to that might end up being better / automated priors (related to, but not the same as, #387).
It would also be interesting to optionally add in cyclic splines to model annual seasonality.
The text was updated successfully, but these errors were encountered:
At the moment we only have one example of using splines in CausalPy, and that's in a non-Bayesian example of the regression discontinuity design.
I would be interesting to see splines used more, particular in a Bayesian notebook. The easiest way to do this would be to extend the existing Excess deaths due to COVID-19 notebook example which just has a basic linear trend. For example, we could modify the equation to
standardize(deaths) ~ 0 + cr(t, df=6) + C(month) + temp
to model the trend with a natural cubic spline.I did give that a quick go, and was able to get a better pre-treatment fit ($R^2=0.75$ ) than the linear trend model ($R^2=0.71$ ), however there were $\hat{R}$ convergence problems. This could be also be related to the mismatch between the scale of the data and the (not cleverly chosen priors), and that is what probably lead me to use the
standardize
function in thepatsy
model formula. One solution to that might end up being better / automated priors (related to, but not the same as, #387).It would also be interesting to optionally add in cyclic splines to model annual seasonality.
The text was updated successfully, but these errors were encountered: