SSquadp3xs: self start for quadratic-plateau function (xs)

SSquadp3xsR Documentation

self start for quadratic-plateau function (xs)

Description

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

Usage

quadp3xs(x, a, b, xs)

SSquadp3xs(x, a, b, xs)

Arguments

x

input vector

a

the intercept

b

the slope

xs

break-point

Details

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

where the quadratic term is (c) is -0.5*b/xs
and the asymptote is (a + (b^2)/(4 * c)).

This model does not estimate the quadratic parameter ‘c’ directly. If this is required, the model ‘SSquadp3’ should be used instead.

Value

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

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

Examples


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