Open tomicapretto opened 2 years ago
Being somewhat thick here, wouldn't be a smoother (no pun intended) option to use bs
and set the degree
and knots
accordingly? That way, the user could have a linear spline to create a piecewise regression.
Yes, you could also do that, but the following points come to my mind:
However, your point is also a motivation to show the connection between piecewise regression using truncate()
and a bs()
using linear functions. That could be a good example.
Fair points. I appreciate that my proposition might be a tad bullish regarding people's familiarity with splines use.
I like when people get involved in the issues and propose new ideas. I really appreciate your comments. So please feel free to share when you want to propose something.
To be a little clearer, I'm not saying that we should only have the example using truncated()
. What I'm saying is that we could have both, and explain the connection between them 😉
@tomicapretto I tried using a custom function but I get this error:
KeyError: 'truncate'
It seems to happen because I have my bambi.Model
as a property in a wrapper Model class and for some reason the truncate method (defined in the same file) can't be found.
@ivanmkc could you share an example of what you're trying to do? What you're suggesting as the problem seems to make sense though.
We can define
And then simply do