SSmoh: self start for modified hyperbola (photosynthesis)

SSmohR Documentation

self start for modified hyperbola (photosynthesis)

Description

Self starter for modified Hyperbola with parameters: asymp, xmin and k

Usage

moh(x, asym, xmin, k)

SSmoh(x, asym, xmin, k)

Arguments

x

input vector (x) which is normally a controlling variable such as nitrogen

asym

asymptotic value when x tends to infinity

xmin

value of x for which y equals zero

k

curvature parameter

Details

This function is described in Archontoulis and Miguez (2015) - (doi:10.2134/agronj2012.0506). See Table S3 (Eq. 3.8)

Value

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

moh: vector of the same length as x (time) using the modified hyperbola

Examples


require(ggplot2)
set.seed(1234)
x <- seq(3, 30)
y <- moh(x, 35, 3, 0.83) + rnorm(length(x), 0, 0.5)
dat <- data.frame(x = x, y = y)
fit <- nls(y ~ SSmoh(x, asym, xmin, k), data = dat)
## Visualize observed and simulated
ggplot(data = dat, aes(x = x, y = y)) + 
  geom_point() + 
  geom_line(aes(y = fitted(fit)))
## Testing predict function
prd <- predict_nls(fit, interval = "confidence")
datA <- cbind(dat, prd)
## Plotting
ggplot(data = datA, aes(x = x, y = y)) + 
  geom_point() + 
  geom_line(aes(y = fitted(fit))) + 
  geom_ribbon(aes(ymin = Q2.5, ymax = Q97.5), 
  fill = "purple", alpha = 0.3)

x <- seq(0, 20)
y <- moh(x, 30, 3, 0.9)
plot(x, y)

nlraa documentation built on May 29, 2024, 2:01 a.m.