Description Usage Arguments Details Value Author(s) References See Also Examples
Function to determine the maximum curvature point of an univariate nonlinear function of x.
1 2 3 4 |
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.
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)
|
Loading required package: rpanel
Loading required package: tcltk
Package `rpanel', version 1.1-4: type help(rpanel) for summary information
Loading required package: MASS
Loading required package: tkrplot
---
soilphysics version 3.1
Warning messages:
1: no DISPLAY variable so Tk is not available
2: loading Rplot failed
Maximum curvature point
f(x) = exp(-x)
critical x: 0.3468694
critical y: 0.7068977
method: general curvature
Maximum curvature point
f(x) = Asym * exp(-b2 * b3^x)
critical x: -0.8741748
critical y: 0.2334863
method: general curvature
Maximum curvature point
f(x) = Asym * exp(-b2 * b3^x)
critical x: 6.45229
critical y: 7.806014
method: perpendicular distances
Maximum curvature point
f(x) = Asym * exp(-b2 * b3^x)
critical x: 7.37416
critical y: 8.059748
method: Linear Response Plateau
Maximum curvature point
f(x) = a * x^-b
critical x: 6.841968
critical y: 10.04186
method: general curvature
Maximum curvature point
f(x) = a * x^-b
critical x: 5.842235
critical y: 11.25142
method: piecewise linear spline
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.