0
$\begingroup$

How can we prove that Natural Cubic Splines are linear at the end points? We just know that the constraint is the second derivative to be zero at the end pints.

$\endgroup$
  • 2
    $\begingroup$ What are you taking as your definition of natural cubic splines? $\endgroup$ – Matthew Drury Jan 8 '18 at 7:03
  • $\begingroup$ A natural cubic spline is a cubic spline that also sets second derivatives to zero at the end points. $\endgroup$ – mBabaee Jan 8 '18 at 8:01
  • 2
    $\begingroup$ So does your question amount to "If the second derivative of a function is zero, how do I show that the function is linear?" $\endgroup$ – Glen_b -Reinstate Monica Jan 8 '18 at 9:42
1
$\begingroup$

First, let us see what is ordinary(without strict) cubic spline:

$$C(u)=\beta_0+\beta_1u+\beta_2u^2+\beta_3u^3+\sum_{j=1}^k\theta_j(u-t_j)_+^3 \tag{1}$$

Here \begin{equation} (u-t_j)_+^n=\begin{cases} (u-t_j)^n, & \text{if $u \ge t_j$}\\ 0, & \text{$u<t_j$} \end{cases} \end{equation} is the truncated power function and

$$0\le t_1<t_2<...<t_k$$

$t_j$ are ordered fixed values and should be pre-defined, they are called knots, and $k$ is the number of knots (not include the two ends of the line).

Next, let see what is the first spline and last spline for this ordinary (without restric) cubic spline.

This first spline (maybe we call it as first tail) is

$$C(u)=\beta_0+\beta_1u+\beta_2u^2+\beta_3u^3 \tag{2}$$

Since within this interval, all $u<t_1$ then $\sum_{j=1}^1\theta_j(u-t_1)_+^3$ will be zero.

Next, let us see what is the last spline, i.e when $u>t_k$ then we write the last spline as:

$$C(u)=\beta_0+\beta_1u+\beta_2u^2+\beta_3u^3+\sum_{j=1}^k\theta_j(u-t_j)_+^3 \tag{3}$$ Note the format of $(3)$ is exactly the same as $(1)$ except here we set $u>t_k$

Now what let us see what are natural ( or restricted) spline is, i.e we force $(2)$ and $(3)$ linear.

For $(2)$ is we want it is linear (Note, here it is not in term of coefficient), we want $\beta_2=0$ and $\beta_3=0$. This will be eqal to we set the second derative of $C''(u)=0$ (if want $C''(u)$ always be zero we need $\beta_2$ and $\beta_3$ be zero, try to do the derivative by yourself), therefore, the first spline will be $C(u)=\beta_0+\beta_1u$ which is linear.

Ok, let see what is the last spline,

$(3)$ can be written as (note $u>t_k$)

\begin{align*} C(u)&=\beta_0+\beta_1u+\beta_2u^2+\beta_3u^3+\theta_1(u-t_1)^3+\theta_2(u-t_2)^3+\theta_3(u-t_3)^3+...+\theta_k(u-t_k)^3 \\&=\beta_0+\beta_1u+\beta_2u^2+\beta_3u^3+\sum_{j=1}^k\theta_j(u-t_j)^3 \\&=\beta_0+\beta_1u+\beta_2u^2+\beta_3u^3+u^3\sum_{j=1}^k\theta_j-3u^2\sum_{j=1}^k\theta_jt_j+3u\sum_{j=1}^k\theta_jt_j^2-\sum_{j=1}^k\theta_jt_j^3 \tag{4} \end{align*}

Therefore, in oder $(3)$ or $(4)$ be linear (not in term of coefficient) we need: :

$$\beta_2=\beta_3=0$$ $$\sum_{j=1}^k\theta_j=0$$ $$\sum_{j=1}^k \theta_j t_j=0$$

These restrict will leave $(3)$ or $(4)$ as

$$C(u)=\beta_0+\beta_1u+3u\sum_{j=1}^k\theta_j t_j^2-\sum_{j=1}^k\theta_j t_j^3 $$ which is linear in term of $u$

These restricts will be equal to set $C''(u)=0$, I will not do these derivatives, you just try second derivative of $(4)$ and set to zero and see what will happen.

Here is a very useful reference.

Time-dependent Covariates with Time in Cox Proportional Hazard Regression Models Using Cubic Spline Functions. Statistics in medicine, 15, 2589-2601.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.