Unknown change point mixture model in JAGS I'm trying to fit a bivariate unknown change point mixed model data comparable to the one described by Wang & McArdle, 2008 (DOI: 10.1080/10705510701758265).
I want to model a linear trend before the change point and a linear trend after the change point. The following is how I defined the respective likelihood. Is that right?
# likelihood for y1 and y2
    for(i in 1:nsubj){
        for(j in 1:ntime){

    y1[i, j] ~ dnorm(muy1[i, j], tauy1)
    muy1[i, j] <- b[i, 1] + b[i, 2] * x[i, j] + b[i, 3] * (max(0, x[i, j] - b[i, 4]))

    y2[i, j] ~ dnorm(muy2[i, j], tauy2)
    muy2[i, j] <- b[i, 5] + b[i, 6] * x[i, j] + b[i, 7] * (max(0, x[i, j] - b[i, 8]))

} }

How do I have to alter the likelihood if I assume no growth before the change point (and the intercept to be at .50) and linear growth after the change point?
Thanks in advance!
 A: The R package mcp uses JAGS to do do regression with change points, and it includes the option do have per-subject change points. Read more in the article on varying change points in mcp.
See my reply to a similar question here. Of particular interest for you, once you have a fit (fit = mcp(model, data = df)), you can see the JAGS code in cat(fit$jags_code).
To model a plateau followed by linear growth, do
model = list(
  y ~ 1,  # plateau
  1 + (1|subj) ~ 0 + x  # joined slope. Change point varies by subj
)
library(mcp)
fit = mcp(model, data = df)

Returning to your question, your likelihood looks about right if you want to model all parameters as varying-by-participant (they are all indexed with i). This looks like overkill to me, though. mcp currently only allows change points to vary and "regular" random effects on the intercepts/slopes will probably be added in the next version. 
As I discuss in the article about priors in mcp (and more formally in this preprinthttps://osf.io/fzqxv/), you should think carefully about the priors for the change points. Here, you can also read how you can set the intercept to 0.5 instead of inferring it.
