(20 points) We observe the following six data points: \[ (x_{i}, y_{i}) \in \{(0, 3), (1, 2), (2, 4), (3, 5), (4, 7), (5, 8)\}, \qquad i = 1, \ldots , 6. \]
We fit a quadratic spline with knots at \(x = 2\) and \(x = 4\) using the truncated power basis \[ 1,\qquad x,\qquad x^{2},\qquad (x - 2)^{2}_{+},\qquad (x - 4)^{2}_{+}, \] where \((x - a)^{2}_{+} = (x - a)^{2}\) if \(x > a\) and \(0\) otherwise.
- Express the data in the linear model form \[ Y = \mathbf {X}\beta + \epsilon , \] clearly specifying the design matrix \(\mathbf {X}\) corresponding to the above basis functions.
- How many degrees of freedom does this spline model have? Justify your answer both in terms of the number of parameters and the number of constraints for this model.
- Explain how you would compute the least squares estimator \(\hat {\beta }\) for this model. You do not need to evaluate the expression.
- Let \[ f(x) = \beta _{0} + \beta _{1}x + \beta _{2}x^{2} + \beta _{3}(x - 2)^{2}_{+} + \beta _{4}(x - 4)^{2}_{+} \] denote a quadratic spline with knots at \(x = 2\) and \(x = 4\). Show that \(f(x)\) and \(f'(x)\) are both continuous at \(x = 2\) and \(x = 4\).