Calculates the design matrix, \(\bold{Z}_s\), of the random effects for a natural cubic smoothing spline as described by Verbyla et al., (1999). An initial design matrix, \(\bold{\Delta} \bold{\Delta}^{-1} \bold{\Delta}\), based on the knot points is computed. It can then be post multiplied by a power of the tri-diagonal matrix \(\bold{G}_s\), \(\bold{G}_s\) being proportional to the assumed variance matrix of the random spline effects. If the power is set to 0.5, then the random spline effects based on the resulting design matrix \(\bold{Z}_s\) are now independent with variance \(\sigma_s^2\). The variance component that estimates \(\sigma_s^2\) will then be a variance ratio and the smoothing parameter is the inverse of the ratio of this variance component to the residual variance.
Zncsspline(knot.points, Gpower = 0, print = FALSE)
A matrix
that is the design matrix \(\bold{Z}_s\).
A numeric
giving the values of the knot points
to be used in fitting the spline. These must be orderd in increasing order.
A numeric
giving the power to take of the tri-diagonal matrix
\(\bold{G}_s\); the initial design matrix is postmultiplied
by the \(\bold{G}_s\) raised to Gpower
to produce
the design matrix \(\bold{Z}_s\) that is returned.
A logical
indicating whether to print the
\(\bold{\Delta}\) and \(\bold{G}_s\) matrices.
Chris Brien
Verbyla, A. P., Cullis, B. R., Kenward, M. G., and Welham, S. J. (1999). The analysis of designed experiments and longitudinal data by using smoothing splines (with discussion). Journal of the Royal Statistical Society, Series C (Applied Statistics), 48, 269-311.
mat.ncssvar
.
Z <- Zncsspline(knot.points = 1:10, Gpower = 0.5)
Run the code above in your browser using DataLab