Description Usage Arguments Examples
Generate design matrix for periodic restricted cubic spline.
1 2 |
x |
numerical x values to transform to new basis |
knots |
vector with locations of the knots of the spline |
nk |
number of knots, used only if the knots are not specified, overridden otherwise |
xmin |
value of the (theoretical) minimum of x |
xmax |
value of the (theoretical) maximum of x |
1 2 3 4 5 6 7 8 9 10 11 12 13 | # load example data; see help("viral_east_mediteranean")
data("viral_east_mediteranean")
# calculate location of knots to use
Knots <-
Hmisc::rcspline.eval(x = viral_east_mediteranean$EpiWeek,
nk = 5, knots.only = TRUE)
# model viral infections vs weeks
model <- glm(RSV ~ rcs_per(EpiWeek, knots = Knots), data = viral_east_mediteranean)
# plot model (with many points, to make it smooth)
plot_per_mod(Model = model, XvarName = "EpiWeek")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.