tp
generates a truncated power basis and bsp
generates a reparameterized b-spline basis for penalized spline smoothing.tp(x, degree=1, k=15, by=NULL, allPen=FALSE, varying=NULL, diag=FALSE,
knots=quantile(x, probs = (1:(k - degree))/(k - degree + 1)),
centerscale=NULL, scaledknots=FALSE)
bsp(x, k=15, spline.degree=3, diff.ord=2, knots, by,
allPen=FALSE, varying, diag=FALSE)
allPen=TRUE
?"X"
: For tp
, it is an n x degree
design matrix for unpenalized part (without intercept) (or a list of those for every level of by if allPen=F); and for bsp
, it is an n x (diff.ord - 1)
design matrix for unpenalized part (without intercept)."Z"
: For tp
, it is an n x (k-degree)
design matrix for penalized part (or a list of those for every level of by if allPen=F); and for bsp
, it is an n x (k - diff.ord+1)
design matrix for penalized part.
tp
generates truncated power bases which have degree
unpenalized basis functions, namely $x^1,\dots, x^{degree}$ and $k-$degree
penalized basis functions that contain the positive part $(x-\kappa_j)^{degree}$ for knots $\kappa_j, j=1,dots,k-$degree
.
This function can be used as a reference when implementing other basisGenerators
that can be used for additive models through cpglmm
. bsp
generate a b-spline basis with equidistant knots in mixed model reparameterization.