dy.dx: Partial Derivative dy/dx

Description Usage Arguments Value Note Author(s) References Examples

View source: R/dy_dx.R

Description

Returns the numerical partial derivate of y wrt x for a point of interest.

Usage

1
2
3
dy.dx(x, y, order = NULL, stn = 0.99, eval.point = median(x),
  deriv.order = 1, h = 0.05, noise.reduction = "mean",
  deriv.method = "FS")

Arguments

x

a numeric vector.

y

a numeric vector.

order

integer; Controls the number of partial moment quadrant means. Defaults to (order = NULL) which generates a more accurate derivative for well specified cases.

stn

numeric [0, 1]; Signal to noise parameter, sets the threshold of NNS.dep which reduces "order" when (order = NULL). Defaults to 0.99 to ensure high dependence for higher "order" and endpoint determination.

eval.point

numeric; x point to be evaluated. Defaults to (eval.point = median(x)). Set to (eval.point = "overall") to find an overall partial derivative estimate.

deriv.order

numeric options: (1, 2); 1 (default) for first derivative. For second derivative estimate of f(x), set (deriv.order = 2).

h

numeric [0, ...]; Percentage step used for finite step method. Defaults to h = .05 representing a 5 percent step from the value of the independent variable.

noise.reduction

the method of determing regression points options: ("mean", "median", "mode", "off"); In low signal to noise situations, (noise.reduction = "median") uses medians instead of means for partitions, while (noise.reduction = "mode") uses modes instead of means for partitions. (noise.reduction = "off") allows for maximum possible fit in NNS.reg. Default setting is (noise.reduction = "mean").

deriv.method

method of derivative estimation, options: ("NNS", "FS"); Determines the partial derivative from the coefficient of the NNS.reg output when (deriv.method = "NNS") or generates a partial derivative using the finite step method (deriv.method = "FS") (Defualt).

Value

Returns the value of the partial derivative estimate for the given order.

Note

If a vector of derivatives is required, ensure (deriv.method = "FS").

Author(s)

Fred Viole, OVVO Financial Systems

References

Viole, F. and Nawrocki, D. (2013) "Nonlinear Nonparametric Statistics: Using Partial Moments" http://amzn.com/1490523995

Vinod, H. and Viole, F. (2017) "Nonparametric Regression Using Clusters" https://link.springer.com/article/10.1007/s10614-017-9713-5

Examples

1
2
3
4
5
x <- seq(0, 2 * pi, pi / 100) ; y <-sin(x)
dy.dx(x, y, eval.point = 1.75)

# Vector of derivatives
dy.dx(x, y, eval.point = c(1.75, 2.5), deriv.method = "FS")

NNS documentation built on May 15, 2018, 5:04 p.m.