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

SSplin

self start for plateau-linear function


Description

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

Usage

plin(x, a, xs, b)

SSplin(x, a, xs, b)

Arguments

x

input vector

a

the initial plateau

xs

break-point of transition between plateau and linear

b

the slope

Details

Initial plateau with a second linear phase. When x < xs: y = a and when x >= xs: y = a + b * (x - xs).

Value

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

plin: vector of the same length as x using the plateau-linear function

Examples

require(ggplot2)
set.seed(123)
x <- 1:30
y <- plin(x, 10, 20, 1) + rnorm(30, 0, 0.5)
dat <- data.frame(x = x, y = y)
fit <- nls(y ~ SSplin(x, a, xs, b), data = dat)
## plot
ggplot(data = dat, aes(x = x, y = y)) + 
  geom_point() + 
  geom_line(aes(y = fitted(fit)))
## Confidence intervals
confint(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.