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
dy.dx(x, y, eval.point = median(x), deriv.order = 1, h = 0.05,
  deriv.method = "FS")

Arguments

x

a numeric vector.

y

a numeric vector.

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.

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" https://www.amazon.com/dp/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
6
7
## Not run: 
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")
## End(Not run)

OVVO-Financial/NNS documentation built on Feb. 14, 2020, 8:16 a.m.