interpretation of the output of R function bs() (B-spline basis matrix)

后端 未结 2 1817
旧巷少年郎
旧巷少年郎 2021-02-03 10:52

I often use B-splines for regression. Up to now I\'ve never needed to understand the output of bs in detail: I would just choose the model I was interested in, and

2条回答
  •  时光说笑
    2021-02-03 11:18

    Just a small correction to the excellent answer by @DeltaIV above (it looks like I can not comment.)

    So in b1, when he calculated b1(x[3]), it should be (38.83333-17.9)/(38.83333-13.3)=0.8198433 by linear interpolation. Everything else is perfect.

    Note b1 should look like this

    \frac{t}{13.3}I(0<=t<13.3)+\frac{38.83333-t}{38.83333-13.3}I(13.3<=t<38.83333)

提交回复
热议问题