Feature Request: Splines
aflaxman opened this issue · comments
Hi all. I would like to start with my appreciation for your work on Bambi
and formulae
! I think both of these are very valuable additions to the scientific python stack. I saw a thread on twitter that made me think formulae
might become the new patsy
, so I thought I would describe an affordance in patsy
that would be really cool to add to formulae
: splines: https://patsy.readthedocs.io/en/latest/spline-regression.html
I would love to be able to include bs(x)
in one line, e.g.
model = bmb.Model("test_positive ~ vaccinated + bs(age,df=3) + (vaccinated+vaccinated:day|state)",
df, family="bernoulli")
Since this is already implemented in patsy
maybe it will not be too hard to add here, as well! Thanks again for all of your work!
Hi @aflaxman! Thanks for opening this issue.
Indeed, adding splines to formulae
is something I've been having on top of my head for a long time now. I'll try to come back to it soon, but I can't promise anything right now.
On the other hand, it's true that patsy
is not going to be developed anymore. I had a meeting with Nathaniel (from patsy) and Matthew (from formulaic) this week and we agreed that Matthew and I are going to provide patsy
with life support, but the future of formula parsers in Python will continue in formulaic
(not formulae).
In the meantime, Bambi will continue using formulae
because it contains more of the features we want than formulaic
. I'll continue supporting and adding stuff to formulae
until formulaic
has all we need. At that time, the idea is that Bambi transitions from formulae
to formulaic
without the end-user even noticing.
I'll post or link splines updates here so you can follow along 😄
See #52. Turns out it wasn't that hard to add b-splines here. Unfortunately there are some things that have to be sorted out in Bambi before this function works there.
#52 has been merged. Do not try to use with Bambi yet, since it does not know how to work with splines yet.
On the other hand, it's true that
patsy
is not going to be developed anymore. I had a meeting with Nathaniel (from patsy) and Matthew (from formulaic) this week and we agreed that Matthew and I are going to providepatsy
with life support, but the future of formula parsers in Python will continue informulaic
(not formulae).
...
At that time, the idea is that Bambi transitions fromformulae
toformulaic
without the end-user even noticing.
@tomicapretto This is great news, which I stumbled across by change, almost worth an announcement somewhere 😄
Hi, @lorentzenchr sorry for the late reply. There's now a note on Patsy README mentioning this change, see here. Maybe an announcement will come after we implement some features such as random effects in Formulaic (which is a WIP). Of course, if you have any ideas or suggestions, I'd love to know them.