Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

SSbell

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

Nonlinear Regression for Agricultural Applications

v0.89
GPL-3
Authors
Fernando Miguez [aut, cre] (<https://orcid.org/0000-0002-4627-8329>), José Pinheiro [ctb, cph] (author of nlme::nlsList, nlme::predict.gnls, nlme::predict.nlme), Douglas Bates [ctb, cph] (author of nlme::nlsList, nlme::predict.gnls, nlme::predict.nlme), R-core [ctb, cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.