This function creates the basis function of a second-order (linear) splines at a user-specific set of break points.
Usage
make_basis(
x,
xname = "x",
internal = NULL,
boundary = range(x),
degree = 1L,
warn = TRUE
)
Arguments
- x
numeric vector
- xname
predictor name. Default is
"x"
- internal
a vector of internal knots, excluding boundary knots
- boundary
vector of external knots
- degree
the degree of the spline. The broken stick model requires linear splines, so the default is
degree = 1
. Settingdegree = 0
yields (crisp) dummy coding, and one column less than fordegree = 1
.- warn
a logical indicating whether warnings from
splines::bs()
should be given.
Value
A matrix with length(x)
rows and length(breaks)
columns, with some extra attributes described by bs()
.