SSbell: self start for a bell-shaped curve

SSbellR Documentation

self start for a bell-shaped curve

Description

Self starter for a type of bell-shaped curve

Usage

bell(x, ymax, a, b, xc)

SSbell(x, ymax, a, b, xc)

Arguments

x

input vector

ymax

maximum value of y

a

parameter controlling the spread (associated with a quadratic term)

b

parameter controlling the spread (associated with a cubic term)

xc

centering parameter

Details

This function is described in Archontoulis and Miguez (2015) - (doi:10.2134/agronj2012.0506). One example application is Hammer et al. (2009) (doi:10.2135/cropsci2008.03.0152).

Value

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

bell: vector of the same length as x using a bell-shaped curve

Examples


require(ggplot2)
set.seed(1234)
x <- 1:20
y <- bell(x, 8, -0.0314, 0.000317, 13) + rnorm(length(x), 0, 0.5)
dat <- data.frame(x = x, y = y)
fit <- nls(y ~ SSbell(x, ymax, a, b, xc), data = dat)
## plot
ggplot(data = dat, aes(x = x, y = y)) + 
  geom_point() + 
  geom_line(aes(y = fitted(fit)))


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