SSplin {nlraa} | R Documentation |
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)
[Package nlraa version 1.9.7 Index]