nlraa (version 0.53)

SSblin: self start for a bilinear Function

Description

Self starter for a bilinear function with parameters a (intercept), b (first slope), xs (break-point), c (second slope)

Usage

blin(x, a, b, xs, c)

SSblin(x, a, b, xs, c)

Arguments

x

input vector

a

the intercept

b

the first-phase slope

xs

break-point of transition between first-phase linear and second-phase linear

c

the second-phase slope

Value

a numeric vector of the same length as x containing parameter estimates for equation specified

blin: vector of the same length as x using the bilinear function

Details

This is a special case with just two parts but a more general approach is to consider a segmented function with several breakpoints and linear segments. Splines would be even more general. Also this model assumes that there is a break-point that needs to be estimated.

See Also

package segmented.

Examples

Run this code
# NOT RUN {
require(ggplot2)
set.seed(1234)
x <- 1:30
y <- blin(x, 0, 0.75, 15, 1.75) + rnorm(30, 0, 0.5)
dat <- data.frame(x = x, y = y)
fit <- nls(y ~ SSblin(x, a, b, xs, c), data = dat)
## plot
ggplot(data = dat, aes(x = x, y = y)) + 
  geom_point() + 
  geom_line(aes(y = fitted(fit)))
# }

Run the code above in your browser using DataLab