Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

maxcurv

Maximum Curvature Point


Description

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

Usage

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 <anderson.agro@hotmail.com>

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

Examples

# 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

Soil Physical Analysis

v4.0
GPL (>= 2)
Authors
Anderson Rodrigo da Silva [aut, cre] (<https://orcid.org/0000-0003-2518-542X>), Renato Paiva de Lima [aut] (<https://orcid.org/0000-0003-0524-439X>)
Initial release
2020-12-06

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.