nlraa (version 0.53)

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

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

Details

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

See Also

package segmented.

Examples

Run this code
# NOT RUN {
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)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab