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

SSquadp3

self start for quadratic-plateau function


Description

Self starter for quadratic plateau function with (three) parameters a (intercept), b (slope), c (quadratic)

Usage

quadp3(x, a, b, c)

SSquadp3(x, a, b, c)

Arguments

x

input vector

a

the intercept

b

the slope

c

quadratic term

Details

The equation is, for a response (y) and a predictor (x):
y ~ (x <= xs) * (a + b * x + c * x^2) + (x >= xs) * (a + (-b^2)/(4 * c))

where the break-point (xs) is -b/c
and the asymptote is (a + (-b^2)/(4 * c))

Value

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

quadp: vector of the same length as x using the quadratic-plateau function

Examples

require(ggplot2)
set.seed(123)
x <- 1:30
y <- quadp3(x, 5, 1.7, -0.04) + rnorm(30, 0, 0.6)
dat <- data.frame(x = x, y = y)
fit <- nls(y ~ SSquadp3(x, a, b, c), 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.