I'm running a GLM and have to hand over discrete values that come from the variable*coefficient
to our IT department.
That said, I'm not sure how to calculate the slopes in a piecewise regression model using the bs()
function from patsy
.
Let's say I have the following model:
y ~ bs(length, degree = 1, knots = [32]
This gives me two rows of the standard pystatsmodel
parameters (coefficeints, pvalues, standard error, etc).
Those values are,
variable coeff
y ~ bs(length, degree = 1, knots = [32][0] .3763
y ~ bs(length, degree = 1, knots = [32][1] .4335
I can also run it like this:
y ~ length + np.maximum(length-32,0)
Which yields
variable coeff
length .0118
length -.0074
What I don't understand is when I run a test set through both of these models, they yield the same prediction.
I'm not sure what patsy is doing in the background in either case and I'm wondering, to answer my question, should I
slope 1 for length should come right from the exponent of the coefficient and slope 2 for length is the exponent(coefficient1 + ceoff2). If that's the case, does that rule apply to both types of syntax?