Learn R Programming

spatstat (version 1.33-0)

deriv.fv: Calculate Derivative of Function Values

Description

Applies numerical differentiation to the values in selected columns of a function value table.

Usage

## S3 method for class 'fv':
deriv(expr, which = "*", ...,
          method=c("spline", "numeric"),
          kinks=NULL)

Arguments

expr
Function values to be differentiated. A function value table (object of class "fv", see fv.object).
which
Character vector identifying which columns of the table should be differentiated. Either a vector containing names of columns, or one of the wildcard strings "*" or "." explained below.
...
Extra arguments passed to smooth.spline to control the differentiation algorithm, if method="spline".
method
Differentiation method. A character string, partially matched to either "spline" or "numeric".
kinks
Optional vector of $x$ values where the derivative is allowed to be discontinuous.

Value

  • Another function value table (object of class "fv") of the same format.

Details

This command performs numerical differentiation on the function values in a function value table (object of class "fv"). The differentiation is performed either by smooth.spline or by a naive numerical difference algorithm.

The command deriv is generic. This is the method for objects of class "fv".

Differentiation is applied to every column (or to each of the selected columns) of function values in turn, using the function argument as the $x$ coordinate and the selected column as the $y$ coordinate. The original function values are then replaced by the corresponding derivatives.

The optional argument which specifies which of the columns of function values in x will be differentiated. The default (indicated by the wildcard which="*") is to differentiate all function values, i.e. all columns except the function argument. Alternatively which="." designates the subset of function values that are displayed in the default plot. Alternatively which can be a character vector containing the names of columns of x.

If the argument kinks is given, it should be a numeric vector giving a value or values of $x$ where the function is not differentiable. Differentiation will be performed separately on intervals between the discontinuity points.

See Also

with.fv, fv.object, smooth.spline

Examples

Run this code
data(cells)
   G <- Gest(cells)
   plot(deriv.fv(G, which=".", spar=0.5))

Run the code above in your browser using DataLab