Build a design matrix for a natural spline basis.
natSplineX(date, origin = NULL, knots, boundaryKnots, constant = TRUE)
A vector with class "Date"
or a vector that can
be coerced to the "Date"
class, typically an unambiguous
character vector.
Optional vector of length 1 with class "Date"
or character that can be coerced to this class. Gives the origin
for the transformation of dates into numeric values. The default
value is 1970-01-01
, see Date
.
A vector with class "Date"
or a vector that
can be coerced to the "Date"
class, giving the location of
the knots as in ns
.
A vector with class "Date"
or a
vector that can be coerced to the "Date"
class, giving the
location of the boundary knots in ns
.
Logical passed as intercept
to
ns
.
An object with class "bts"
inheriting from
"matrix"
. This is essentially a numeric matrix having the
value of the basis functions as its columns. Each row corresponds
to an element of the given date
vector. By convention, the
columns are named "ns1"
, "ns2"
, ... The number of
colums is equal to df
is provided or if knots was supplied,
to length(knots) + 1 + constant
.
The design matrix contains a basis to represent a natural spline
with possibly chosen knots if needed. By default the boundary
knots are chosen as the range of the numeric translation of
date
. The basis generates a space of cubic splines with
their second order derivative vanishing at the two boundary
knots. Therefore, the splines behave as a polynomials of degree
one outside of the boundary knots.