SSquadp: self start for quadratic-plateau function

SSquadpR Documentation

self start for quadratic-plateau function

Description

Self starter for quadratic plateau function with parameters a (intercept), b (slope), c (quadratic), xs (break-point)

Usage

quadp(x, a, b, c, xs)

SSquadp(x, a, b, c, xs)

Arguments

x

input vector

a

the intercept

b

the slope

c

quadratic term

xs

break point of transition between quadratic and plateau

Details

Reference for nonlinear regression Archontoulis and Miguez (2015) - (doi:10.2134/agronj2012.0506).

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 <- quadp(x, 5, 1.7, -0.04, 20) + rnorm(30, 0, 0.6)
dat <- data.frame(x = x, y = y)
fit <- nls(y ~ SSquadp(x, a, b, c, xs), data = dat, algorithm = "port")
## 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.