I am current using the package (lme4) for a mixed effect model with random effects.
My model takes the form:
mod <- lmer(response ~ b1(predict1, bp) + b2(predict2, bp) + (1 | site), data = data)
The functions b1 and b2 come from the helpful advice in:
b1 <- function(x, bp) ifelse(x < bp, bp - x, 0) b2 <- function(x, bp) ifelse(x < bp, 0, x - bp)
I am wondering, how would I set up my model so that the second part (line) of the broken stick model has a constant gradient?
So for example, I would like something like:
If X < breakpoint, Y = m1X + C1
If X > breakpoint, Y = C2
Hope I am making sense.