| Functional basis function {fctbases} | R Documentation |
Functional basis function
Description
A fctbases object is a function of class fctbasis which takes three arguments (t, x, deriv)
Arguments
t |
time points |
x |
vector or matrix of coefficients (optional) |
deriv |
Should the derivative be used and which order? Defaults to |
Details
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.
Value
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)
Examples
## 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.
[Package fctbases version 1.1.1 Index]