Description Usage Arguments Value Author(s) Examples
Construction of quantile-based linear spline basis
1 2 |
x |
the covariate vector |
type |
the type of splines to be used, “linear” splines modelled by a truncated power series basis, or “cubic” splines modelled by O'Sullivan splines. |
nKnots |
number of quantile-based knots to be used |
settings |
list of settings. By default, this is
|
the spline basis in a matrix with length(x)
rows.
As an attribute, a list with the settings is provided.
Daniel Sabanes Bove daniel.sabanesbove@ifspm.uzh.ch
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | x <- seq(from=-5,
to=5,
length=1000)
Z <- makeBasis(x=x,
nKnots=4L,
type="linear")
str(Z)
plot(x,
Z %*% c(1, -3, 2, 1),
type="l")
abline(v=attr(Z, "knots"),
col="gray",
lty=2)
Z <- makeBasis(x=x,
nKnots=10L,
type="cubic")
dimZ <- ncol(Z)
coefs <- rnorm(dimZ)
plot(x,
Z %*% coefs,
type="l")
abline(v=attr(Z, "knots"),
col="gray",
lty=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.