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 matrix
tf_derive(f, arg, order = 1, ...)
# S3 method for tfd
tf_derive(f, arg, order = 1, ...)
# S3 method for tfb_spline
tf_derive(f, arg, order = 1, ...)
# S3 method for tfb_fpc
tf_derive(f, arg, order = 1, ...)
a tf (with slightly different arg or basis for the
derivatives, see Details)
a tf-object
grid to use for the finite differences.
Not the arg of the returned object for tfd-inputs, see Details.
order of differentiation. Maximal value for tfb_spline is 2.
not used
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.
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.
Other tidyfun calculus functions:
tf_integrate()