The title says it all. For more info: I have a dependent and independent variable $y$ and $X$. I want to fit a square spline on the data given a single knot $k$. I can do that by fitting 2 separate square functions in the areas $X\le k$ and $X>k$ with the constraint that they have to have a common point at $X=k$ by fitting (OLS) the following regression equation:
$$ y_t = \beta_0 + \beta_1 X_t + \beta_2 X_t^2 + \beta_3 (X_t-k)_+ + \beta_4(X_t-k)_+^2 + \varepsilon_t $$
where $(X-k)_+ = max(X-k, 0)$ is a truncated function.
However, the resulting fit is discontinuous at $k$, e.g: (here $k=2.5$)
To make the fit continuous at $k$ one just needs to drop the lower-order terms of the truncated function, i.e. this is the same as above without $\beta_3 (X_t-k)_+ $ (see also this video): $$ y_t = \beta_0 + \beta_1 X_t + \beta_2 X_t^2 + \beta_4(X_t-k)_+^2 + \varepsilon_t $$
Now I get a continuous function (in the first derivative) at $X=k$:
The question is: Why?
If I take the derivative of the functions before and after $k$ I get: $$f'(X)=\beta_1 + 2\beta_2 X_t + 2\beta_4 (X_t>k) $$
- before $k$: $f'(k)=\beta_1 + 2\beta_2 k + 0 $
- after $k$ (meaning something like $\lim_{X\to k, X > k}{(f'(X))}$: $f'(k)=\beta_1 + 2\beta_2 k + 2\beta_4k $, since $ (X_t-k)_+$ is only active if $X_t>k$.
So the two are different, one includes $2\beta_4k$ the other one doesn't. How are they the same?