maxcurv: Maximum Curvature Point

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/maxcurv.R

Description

Function to determine the maximum curvature point of an univariate nonlinear function of x.

Usage

1
2
3
4
 maxcurv(x.range, fun, 
	method = c("general", "pd", "LRP", "spline"), 
	x0ini = NULL, 
	graph = TRUE, ...) 

Arguments

x.range

a numeric vector of length two, the range of x.

fun

a function of x; it must be a one-line-written function, with no curly braces '{}'.

method

a character indicating one of the following: "general" - for evaluating the general curvature function (k), "pd" - for evaluating perpendicular distances from a secant line, "LRP" - a NLS estimate of the maximum curvature point as the breaking point of Linear Response Plateau model, "spline" - a NLS estimate of the maximum curvature point as the breaking point of a piecewise linear spline. See details.

x0ini

an initial x-value for the maximum curvature point. Required only when "LRP" or "spline" are used.

graph

logical; if TRUE (default) a curve of fun is plotted.

...

further graphical arguments.

Details

The method "LRP" can be understood as an especial case of "spline". And both models are fitted via nls. The method "pd" is an adaptation of the method proposed by Lorentz et al. (2012). The "general" method should be preferred for finding global points. On the other hand, "pd", "LRP" and "spline" are suitable for finding local points of maximum curvature.

Value

A list of

fun

the function of x.

x0

the x critical value.

y0

the y critical value.

method

the method of determination (input).

Author(s)

Anderson Rodrigo da Silva <[email protected]>

References

Lorentz, L.H.; Erichsen, R.; Lucio, A.D. (2012). Proposal method for plot size estimation in crops. Revista Ceres, 59:772–780.

See Also

function, curve

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Example 1: an exponential model
f <- function(x) exp(-x)
maxcurv(x.range = c(-2, 5), fun = f)

# Example 2: Gompertz Growth Model
Asym <- 8.5
b2 <- 2.3
b3 <- 0.6
g <- function(x) Asym * exp(-b2 * b3 ^ x)
maxcurv(x.range = c(-5, 20), fun = g)

# using "pd" method
maxcurv(x.range = c(-5, 20), fun = g, method = "pd")

# using "LRP" method
maxcurv(x.range = c(-5, 20), fun = g, method = "LRP", x0ini = 6.5)

# Example 3: Lessman & Atkins (1963) model for optimum plot size
a = 40.1
b = 0.72
cv <- function(x) a * x^-b
maxcurv(x.range = c(1, 50), fun = cv)

# using "spline" method
maxcurv(x.range = c(1, 50), fun = cv, method = "spline", x0ini = 6)

# End (not run)

soilphysics documentation built on May 30, 2017, 2:49 a.m.