zhijie zhang
2008-Mar-24 07:36 UTC
[R] What is the correct model formula for the results of piecewise linear function?
Dear friends,
I used the B-spline (degree=1) method to fit the piecewise linear function
and the results are listed below.
m.glm<-glm(mark~x+poly(elevation,2)+bs(distance,degree=1,knots=c(16.13,24))
+bs(y,degree=1,knots=c(-0.4357,-0.3202
)),family=binomial(logit),data=point)
summary(m.glm)
Coefficients:
Estimate Std. Error z
value Pr(>|z|)
(Intercept) 12.104 3.138
3.857 0.000115 ***
x 5.815 1.987
2.926 0.003433 **
poly(elevation, 2)1 6.654 4.457
1.493 0.135444
poly(elevation, 2)2 -6.755 3.441 -
1.963 0.049645 *
bs(distance, degree = 1, knots = c(16.13, 24))1 -1.291 1.139 -
1.133 0.257220
bs(distance, degree = 1, knots = c(16.13, 24))2 -10.348 2.025
-5.110 3.22e-07 ***
bs(distance, degree = 1, knots = c(16.13, 24))3 -3.530 3.752 -
0.941 0.346850
bs(y, degree = 1, knots = c(-0.4357, -0.3202))1 -6.828 1.836 -
3.719 0.000200 ***
bs(y, degree = 1, knots = c(-0.4357, -0.3202))2 -4.426 1.614 -
2.742 0.006105 **
bs(y, degree = 1, knots = c(-0.4357, -0.3202))3 -11.216 2.861 -
3.920 8.86e-05 ***
I think bs(degree=1) has fitted the piecewise linear functions. Now i hope
to write the model formua for the above results, but not very sure about how
to write the correct results for *distance* and *y,* because they have three
parts .
Logitp=12.104 + 5.815*x + 6.654*elevation - 6.755*elevation^2
-1.291*distance1 - 10.348*distance2 - 3.53*distance3
-6.828*y1 - 4.426*y2 - 11.216*y3
In the above formula, distance1-3 denotes the three linear functions
for*distance
*, my problem is how to replace distace1-3 using original variable *distance
*? The same question is for *y*.
Could anybody please show me the correct model formula according to the
above result?
Thanks a lot.
--
With Kind Regards,
Zhi Jie
[[alternative HTML version deleted]]
