I would like to derive the basis functions for restricted cublic splines with K knots ($\epsilon_1,...,\epsilon_K$):

$h_1(X)=1\text{, }h_2(X)=X\text{, }h_{j+2}(X) = d_j(X)-d_{K-1}(X)\text{, }j=1\text{ to } K-2 $

where $d_j(X)=\frac{(X-\epsilon_j)^{3}_+ - (X-\epsilon_K)^{3}_+}{\epsilon_K-\epsilon_j}$.

I started with the basis functions for the cubic splines: $f(X)=\sum_{j=0}^{3}\alpha_jX^j+\sum_{j=1}^{K}\beta_j(X-\epsilon_j)^3_+$ It' s easy to see that $\alpha_2$ and $\alpha_3$ should be zero to make the first region linear. Then, to delete second and third order terms in the last region, the following constraints should be met: $\sum_{j=1}^{K}\beta_j=0$ and $\sum_{j=1}^{K}\epsilon_j\beta_j=0$.

Now, I should use the last two constraints in $f$ to obtain $h_{j+2}$. I started by separating the last term from the sum ($k=K$).

So I have: $\sum_{j=1}^{K}\beta_j(X-\epsilon_j)^3_+ = \sum_{j=1}^{K-1}\beta_j(X-\epsilon_j)^3_+ + \beta_K(X-\epsilon_K)^3_+$.

Hence, $\sum_{j=1}^{K}\beta_j(X-\epsilon_j)^3_+ = \sum_{j=1}^{K-1}\beta_j(X-\epsilon_j)^3_+ - \sum_{j=1}^{K-1}\beta_j(X-\epsilon_K)^3_+$ (first constraint)

Then, $\sum_{j=1}^{K}\beta_j(X-\epsilon_j)^3_+ = \sum_{j=1}^{K-1}\beta_j\bigl((X-\epsilon_j)^3_+-(X-\epsilon_K)^3_+\bigr)$

Now I should use the second constraint and I tried to separate the $K-1$ term from the sum, but I don't see how to end with that.

If someone could help me!

Thanks a lot.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.