SSlinp: self start for linear-plateau function

SSlinpR Documentation

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)



femiguez/nlraa documentation built on Jan. 26, 2024, 9:31 p.m.