smooth.cons.integral | R Documentation |
Almost identical to smooth.cons
. This version is dedicated to Gauss-Legendre
quadrature. Here, the sum-to-zero constraints must be specified so that they correspond to the ones that
were calculated with the initial dataset.
smooth.cons.integral(
term,
knots,
df,
by = NULL,
option,
data.spec,
Z.smf,
Z.tensor,
Z.tint,
name
)
term |
Vector of strings that generally comes from the value "term" of a smooth.spec object |
knots |
List of numeric vectors that specifies the knots of the splines (including boundaries). |
df |
Degrees of freedom : numeric vector that indicates the number of knots desired for each covariate. |
by |
numeric or factor variable in order to define a varying coefficient smooth; default is NULL. |
option |
"smf", "tensor" or "tint". |
data.spec |
data frame that represents the environment from which the covariate values and knots are to be calculated; default is NULL. |
Z.smf |
List of matrices that represents the sum-to-zero constraint to apply for |
Z.tensor |
List of matrices that represents the sum-to-zero constraint to apply for |
Z.tint |
List of matrices that represents the sum-to-zero constraint to apply for |
name |
simplified name of the smooth.spec call. |
design matrix
library(survPen)
# standard spline of time with 4 knots (so we get a design matrix with 3 columns
# because of centering constraint)
data <- data.frame(time=seq(0,5,length=100))
# retrieving sum-to-zero constraint matrices
Z.smf <- smooth.cons("time",knots=list(c(0,1,3,5)),df=4,option="smf",
data.spec=data,name="smf(time)")$Z.smf
# constructing the design matrices for Gauss-Legendre quadrature
smooth.c.int <- smooth.cons.integral("time",knots=list(c(0,1,3,5)),df=4,option="smf",data.spec=data,
name="smf(time)",Z.smf=Z.smf,Z.tensor=NULL,Z.tint=NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.