tf_derive {tf} | R Documentation |
Differentiating functional data: approximating derivative functions
Description
Derivatives of tf
-objects use finite differences of the evaluations for
tfd
and finite differences of the basis functions for tfb
.
Usage
tf_derive(f, arg, order = 1, ...)
## S3 method for class 'matrix'
tf_derive(f, arg, order = 1, ...)
## S3 method for class 'tfd'
tf_derive(f, arg, order = 1, ...)
## S3 method for class 'tfb_spline'
tf_derive(f, arg, order = 1, ...)
## S3 method for class 'tfb_fpc'
tf_derive(f, arg, order = 1, ...)
Arguments
f |
a |
arg |
grid to use for the finite differences.
Not the |
order |
order of differentiation. Maximal value for |
... |
not used |
Details
The derivatives of tfd
objects use centered finite differences, e.g. for
first derivatives f'((t_i + t_{i+1})/2) \approx \frac{f(t_i) +
f(t_{i+1})}{t_{i+1} - t_i}
, so the domains of differentiated tfd
will
shrink (slightly) at both ends. Unless the tfd
has a rather fine and
regular grid, representing the data in a suitable basis representation with
tfb()
and then computing the derivatives or integrals of those is usually
preferable.
Note that, for some spline bases like "cr"
or "tp"
which always begin/end
linearly, computing second derivatives will produce artefacts at the outer
limits of the functions' domain due to these boundary constraints. Basis
"bs"
does not have this problem for sufficiently high orders, but tends to
yield slightly less stable fits.
Value
a tf
(with slightly different arg
or basis
for the
derivatives, see Details)
Methods (by class)
-
tf_derive(matrix)
: row-wise finite differences -
tf_derive(tfd)
: derivatives by finite differencing. -
tf_derive(tfb_spline)
: derivatives by finite differencing. -
tf_derive(tfb_fpc)
: derivatives by finite differencing.
See Also
Other tidyfun calculus functions:
tf_integrate()