SSlinp {nlraa} | R 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 and flat (
) when
.
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)
[Package nlraa version 1.9.7 Index]