Learn R Programming

pmcalibration (version 0.1.0)

reg_spline_X: Make a design matrix for regression spline

Description

Make a design matrix for regression spline

Usage

reg_spline_X(x, xp, smooth, ...)

Value

a list containing

  • X the design matrix for the data

  • Xp the design matrix for plotting

Arguments

x

values of the predictor

xp

values of the predictor for plotting the calibration curve

smooth

spline to use (rms::rcs, splines::ns, splines::bs currently supported via 'rcs', 'ns', 'bs'). smooth = 'none' results in x as only predictor (i.e., no spline)

...

additional arguments for specific splines ('nk' or 'knots' for 'rcs', 'df' or 'knots' for 'ns' or 'bs')

Examples

Run this code
x <- rnorm(100)
xp <- seq(min(x), max(x), length.out=50)
reg_spline_X(x = x, xp = xp, smooth="rcs", nk=6)

Run the code above in your browser using DataLab