Learn R Programming

nlraa (version 0.98)

SSlogis5: self start for five-parameter logistic function

Description

Self starter for a five-parameter logistic function.

Usage

logis5(x, asym1, asym2, xmid, iscal, theta)

SSlogis5(x, asym1, asym2, xmid, iscal, theta)

Arguments

x

input vector (x)

asym1

asymptotic value for low values of x

asym2

asymptotic value for high values of x

xmid

value of x at which y = (asym1 + asym2)/2 (only when theta = 1)

iscal

steepness of transition from asym1 to asym2 (inverse of the scale)

theta

asymmetry parameter, if it is equal to 1, this is the four parameter logistic

Value

a numeric vector of the same length as x (time) containing parameter estimates for equation specified

logis5: vector of the same length as x (time) using the 5-parameter logistic

Details

The equation for this function is:

$$f(x) = asym2 + (asym1 - asym2)/(1 + exp(iscal * (log(x) - log(xmid))))^theta$$

This is known as the Richards' function or the log-logistic and it is described in Archontoulis and Miguez (2015) - (doi:10.2134/agronj2012.0506).

Examples

Run this code
# NOT RUN {
require(ggplot2)
set.seed(1234)
x <- seq(0, 2000, 100)
y <- logis5(x, 35, 10, 800, 5, 2) + rnorm(length(x), 0, 0.5)
dat <- data.frame(x = x, y = y)
fit <- nls(y ~ SSlogis5(x, asym1, asym2, xmid, iscal, theta), data = dat)
## plot
ggplot(data = dat, aes(x = x, y = y)) + 
  geom_point() + 
  geom_line(aes(y = fitted(fit)))
# }
# NOT RUN {
x <- seq(0, 2000)
y <- logis5(x, 30, 10, 800, 5, 2)
plot(x, y)
# }

Run the code above in your browser using DataLab