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

SSlinp

self start for linear-plateau function


Description

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

Usage

linp(x, a, b, xs)

SSlinp(x, a, b, xs)

Arguments

x

input vector

a

the intercept

b

the slope

xs

break-point of transition between linear and plateau

Details

This function is linear when x < xs: (a + b * x) and flat (asymptote = a + b * xs) when x >= xs.

Value

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

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

See Also

package segmented.

Examples

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