qknots: Specification of the knots of a cubic B-spline basis for...

View source: R/qknots.R

qknotsR Documentation

Specification of the knots of a cubic B-spline basis for given data.

Description

Specification of the knots of a cubic B-spline basis for given data.

Usage

qknots(x, xmin=NULL, xmax=NULL,
       equid.knots = TRUE, pen.order=2, K=25)

Arguments

x

data that should be supported by the knots of the B-spline basis.

xmin

(Optional) minimum value for the knots.

xmax

(Optional) maximum value for the knots.

equid.knots

Logical indicating if equidistant knots are desired (Default: TRUE).

pen.order

penalty order (if equid.knots = TRUE) (Default: 2).

K

number of B-splines in the basis (Default: 25).

Value

a list containing the following elements:

  • xmin : minimum value of the knots.

  • xmax : maximum value of the knots.

  • knots : vector containing the knots: equidistant if equid.knots is TRUE, based on quantiles of x otherwise.

  • Pd : penalty matrix for the B-spline coefficients.

  • pen.order : penalty order for the P-spline model.

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 = rnorm(100)
qknots(x)

tvcure documentation built on April 12, 2025, 1:58 a.m.