smooth.cons | R Documentation |
Builds the design and penalty matrices from the result of smooth.spec
.
smooth.cons(
term,
knots,
df,
by = NULL,
option,
data.spec,
same.rho = FALSE,
name
)
term |
Vector of strings that generally comes from the value "term" of a |
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. |
same.rho |
if there is a factor by variable, should the smoothing parameters be the same for all levels; default is FALSE. |
name |
simplified name of the smooth.spec call. |
List of objects with the following items:
X |
Design matrix |
pen |
List of penalty matrices |
term |
Vector of strings giving the names of each covariate |
knots |
list of numeric vectors that specifies the knots for each covariate |
dim |
Number of covariates |
all.df |
Numeric vector giving the number of knots associated with each covariate |
sum.df |
Sum of all.df |
Z.smf |
List of matrices that represents the sum-to-zero constraint to apply for "smf" splines |
Z.tensor |
List of matrices that represents the sum-to-zero constraint to apply for "tensor" splines |
Z.tint |
List of matrices that represents the sum-to-zero constraint to apply for "tint" splines |
lambda.name |
name of the smoothing parameters |
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))
smooth.c <- smooth.cons("time",knots=list(c(0,1,3,5)),df=4,option="smf",
data.spec=data,name="smf(time)")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.