tf_derive | R Documentation |
Derivatives of tf
-objects use finite differences of the evaluations for
tfd
and finite differences of the basis functions for tfb
.
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, ...)
f |
a |
arg |
grid to use for the finite differences.
Not the |
order |
order of differentiation. Maximal value for |
... |
not used |
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.
a tf
(with slightly different arg
or basis
for the
derivatives, see Details)
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.
Other tidyfun calculus functions:
tf_integrate()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.