A hat matrix for monotonicity constrained B spline and P spline regression
Splines constitute an interesting way to flexibly estimate a nonlinear relationship between several covariates and a response variable using linear regression techniques. The popularity of splines is due to their easy application and hence the low computational costs since their basis functions can be added to the regression model like usual covariates. As long as no inequality constraints and penalties are imposed on the estimation, the degrees of freedom of the model estimation can be determined straightforwardly as the number of estimated parameters. This paper derives a formula for computing the hat matrix of a penalized and inequality constrained splines estimator. Its trace gives the degrees of freedom of the model estimation which are necessary for the calculation of several information criteria that can be used e.g. for specifying the parameters for the spline or for model selection.