Description Public fields Methods
The penalized spline smooths are constructed using the mgcv package. See also:
mgcv::s()
mgcv::smooth.terms
mgcv::smoothCon()
terms
The names of the covariates as a character vector.
data
The data frame from which the covariates are extracted.
bs
A basis abbreviation as defined in mgcv.
Defaults to "tp"
.
k
The basis dimension before constraints and penalization. Defaults to 10.
m
The order of the penalty.
Defaults to NA
for auto-initialization.
xt
Extra information to set up the basis.
Defaults to NULL
.
knots
The knots for the basis construction as a data frame with
the terms as names. Defaults to NULL
for auto-initialization
with mgcv's basis-specific method.
constraints
A matrix of (identifiability) constraints. Defaults
to NULL
, in which case only a centering constraint
will be applied.
absorb_constraints
If the constraints should be absorbed into the
basis. Defaults to TRUE
.
scale_penalty
If the penalty matrices should be scaled to match
the inner product of the design matrix. Defaults to
TRUE
.
identity_penalty
If the smooth should be reparameterized to turn
the penalty matrices into identity matrices. This
is more or less equivalent to
mgcv::smooth2random()
.
Defaults to FALSE
.
new()
Create a new smooth object.
Smooth$new(terms, data, bs = "tp", k = 10)
terms
The names of the covariates as a character vector.
data
The data frame from which the covariates are extracted.
bs
A basis abbreviation as defined in mgcv.
Defaults to "tp"
.
k
The basis dimension before constraints and penalization. Defaults to 10.
initialize_knots()
Initialize knots using mgcv's basis-specific method.
Smooth$initialize_knots()
initialize_constraints()
Initialize constraints with a centering constraint.
Smooth$initialize_constraints()
add_centering_constraint()
Add a centering constraint.
Smooth$add_centering_constraint()
add_point_constraints()
Add a point constraint where the smooth should pass through zero.
Smooth$add_point_constraints(data)
data
A data frame with the terms as names defining where the smooth should pass through zero.
remove_all_constraints()
Remove all constraints (including the centering constraint).
Smooth$remove_all_constraints()
construct()
Construct the design matrix and the penalty matrices.
Smooth$construct(data = NULL)
data
An optional data frame if different data should be used for the construction of the design matrix than the basis.
A list with the elements design_matrix
, penalty_matrices
and
ranks
.
clone()
The objects of this class are cloneable with this method.
Smooth$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.