nlraa (version 0.53)

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

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

Details

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

Examples

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

Run the code above in your browser using DataCamp Workspace