centeredBasis.gen {tvcure} | R Documentation |
Generation of a recentered cubic B-spline basis matrix.
Description
Generation of a cubic B-spline basis matrix with recentered columns to handle the identifiability constraint in additive models. See Wood (CRC Press 2017, pp. 175-176) for more details.
Usage
centeredBasis.gen(x, knots, cm = NULL, pen.order = 2)
Arguments
x |
Vector of values where the "recentered" B-spline basis is evaluated. |
knots |
Vector of knots that must cover the values in |
cm |
(Optional) values subtracted from each column of the original B-spline matrix. |
pen.order |
Order of the penalty applied on B-spline parameters. (Default: 2). |
Value
List containing
-
B
: centered cubic B-spline matrix obtained by subtractingcm[j]
from the jth B-spline in column j of the original B-spline matrix evaluated atx
. -
Dd
: difference matrix (of orderpen.order
) for the associated centered B-spline matrix. -
Pd
: penalty matrix (of orderpen.order
) for the associated centered B-spline matrix. -
K
: number of centered B-splines in the basis. -
cm
: values subtracted from each column of the original B-spline matrix. By default, this is a vector containing the mean of each column in the original B-spline matrix.
Author(s)
Philippe Lambert p.lambert@uliege.be
References
Lambert, P. and Kreyenfeld, M. (2025). Time-varying exogenous covariates with frequently changing values in double additive cure survival model: an application to fertility. Journal of the Royal Statistical Society, Series A. <doi:10.1093/jrsssa/qnaf035>
Examples
x = seq(0,1,by=.01)
knots = seq(0,1,length=5)
obj = centeredBasis.gen(x,knots)
matplot(x,obj$B,type="l",ylab="Centered B-splines")
colMeans(obj$B)