SSratio | R Documentation |
Self starter for a rational curve
ratio(x, a, b, c, d)
SSratio(x, a, b, c, d)
x |
input vector |
a |
parameter related to the maximum value of the response (numerator) |
b |
power exponent for numerator |
c |
parameter related to the maximum value of the response (denominator) |
d |
power exponent for denominator |
The equation is:
a * x ^ c / (1 + b * x ^ d)
This function is described in Archontoulis and Miguez (2015) - (doi:10.2134/agronj2012.0506). One example application is in Bril et al. (1994) https://edepot.wur.nl/333930 - pages 19 and 21. The parameters are difficult to interpret, but the function is very flexible. I have not tested this, but it might be beneficial to re-scale x and y to the (0,1) range if this function is hard to fit. https://en.wikipedia.org/wiki/Rational_function.
a numeric vector of the same length as x containing parameter estimates for equation specified
ratio: vector of the same length as x using a rational function
require(ggplot2)
require(minpack.lm)
set.seed(1234)
x <- 1:100
y <- ratio(x, 1, 0.5, 1, 1.5) + rnorm(length(x), 0, 0.025)
dat <- data.frame(x = x, y = y)
fit <- nlsLM(y ~ SSratio(x, a, b, c, d), data = dat)
## plot
ggplot(data = dat, aes(x = x, y = y)) +
geom_point() +
geom_line(aes(y = fitted(fit)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.