Functional basis function | R Documentation |
A fctbases object is a function of class fctbasis
which takes three arguments (t, x, deriv)
t |
time points |
x |
vector or matrix of coefficients (optional) |
deriv |
Should the derivative be used and which order? Defaults to |
If deriv
is zero or FALSE
, the function itself is evaluated.
If deriv
is one or TRUE
, the first derivative is evaluated.
If deriv
is two, the second derivative is evaluated.
The dimension of x
must match the number of basis functions.
Returns a matrix of dimension length(t)
times no. of bases if x
is missing.
If x
is provided and is a vector, it returns a vector of same length as t
.
If x
is provided and is a matrix, it returns a matrix of dimension length(t)
times ncol(x)
## Create basis (here a b spline) bf <- make.bspline.basis(knots = 0:12/12) ## Use a functional basis bf(0.2) tt <- seq(0,1, length = 50) bf(tt) ## evaluates bf in tt bf(tt, deriv = TRUE) ## evaluates derivative of bf in tt ## Apply bf to some coefficients set.seed(661) x <- runif(15) bf(tt, x) ## Evaluate bf in tt with coefficients x. bf(0.2, deriv = 2) ## Second derivative. bf(0.2, x, deriv = 2) ## Second derivative with coefficients x.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.