maxcurv | R Documentation |
Function to determine the maximum curvature point of an univariate nonlinear function of x.
maxcurv(x.range, fun, method = c("general", "pd", "LRP", "spline"), x0ini = NULL, graph = TRUE, ...)
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 |
... |
further graphical arguments. |
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.
A list of
fun |
the function of x. |
x0 |
the x critical value. |
y0 |
the y critical value. |
method |
the method of determination (input). |
Anderson Rodrigo da Silva <anderson.agro@hotmail.com>
Lorentz, L.H.; Erichsen, R.; Lucio, A.D. (2012). Proposal method for plot size estimation in crops. Revista Ceres, 59:772–780.
function
, curve
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.