tp {cplm}R Documentation

Generate basis functions for penalized spline smoothing.


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,, diff.ord=2, knots, by,
    allPen=FALSE, varying, diag=FALSE)



covariate for the smooth function


integer: degree of truncated polynomials (0: piecewise constant, 1: piecewise linear etc..)


integer: dimensionality of the basis (i.e.: number of knots + degree)


factor variable: estimate separate functions for each level - this assumes standard treatment contrasts for the supplied factor.


boolean: if TRUE, make design for group-specific curves with common smoothing parameter: all parameters (including the normally unpenalized basis functions in X) are penalized, every level of "by" has the same amount of smoothing if FALSE, make design for separate curves for each by-level: separate smoothing parameters for every level of "by", unpenalized estimates for the coefficients associated with X


numeric: if not NULL, a varying coefficient model is fit: f(x,varying) = f(x)*varying


logical: force a diagonal covariance-matrix for the random effects for X if allPen=TRUE?


vector of knot locations (optional). Defaults to quantile-based knots at the i/(k+1-degree)-quantiles for i=1,\dots,k-degree.


numeric(2): center&scale x by these values if not NULL


boolean: are knot locations given for the rescaled x-values?

integer: degree of B-splines (defaults to cubic)


integer: order of the difference penalty on the un-reparamerized spline coefficients. Defaults to 2, that is, penalized deviations from linearity.


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.


list with entries: "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.


These are from the amer package that has retired from CRAN.


Fabian Scheipl

[Package cplm version 0.7-12 Index]