My growth model estimates random intercepts & random gradients for each individual, longitudinally in time. Its current specification is working. I would now like to make the intercept term belong to a 2component Normal mixture distribution.
1) Current growth model (working)
The response is y
and the growth term is time
. Censoring is also included. The ID1
term allows correlation between parameters. The SUBJ
term is the hierarchical bit of the model and accounts for repeated measures by individual SUBJ
. The traditional constant sigma term (i.e. sigma ~ 1
) is replaced with one depending on a (nonlinear) exponential of the response using extra parameters sigmaA
, sigmaB
& sigmaC
.
get_prior(data = dataset,
family = gaussian(),
formula = bf(y  cens(cen1) ~ popnintercept + time) +
lf(popnintercept + time ~ 1 + (1ID1SUBJ)) +
nlf(sigma ~ sigmaA * exp(sigmaB * y) + sigmaC) +
lf(sigmaA + sigmaB + sigmaC ~ 1) +
set_nl(nl = TRUE)
)
This produces the following terms which I’ve rewritten here to help my understanding. Note they don’t match the exact brms
syntax: cor, popnintercept(b), popnintercept(sd), sigmaA(b), sigmaB(b), sigmaC(b), time(b), time(sd).
2) First attempt (successful)
I have managed to split the intercept into mu1
& mu2
:
mix = mixture(gaussian, gaussian)
get_prior(data = dataset,
family = mix,
formula = bf(y  cens(cen1) ~ 1 + time +
(1 + timeID1SUBJ))
)
It now contains cor, sigma1, sigma2, theta, mu1(Intercept), mu1(sd), mu2(Intercept), mu2(sd), time_mu1(b), time_mu1(sd), time_mu2(b), time_mu2(sd).
3) Nonconstant sigma1
& sigma2
(unsuccessful)
Building on 2) above:
get_prior(data = dataset,
family = mix,
formula = bf(y  cens(cen1) ~ 1 + time +
(1 + timeID1SUBJ)) +
nlf(sigma1 ~ sigmaA1 * exp(sigmaB1 *y) + sigmaC1) +
lf(sigmaA1 + sigmaB1 + sigmaC1 ~ 1) +
nlf(sigma2 ~ sigmaA2 * exp(sigmaB2 * y) + sigmaC2) +
lf(sigmaA2 + sigmaB2 + sigmaC2 ~ 1) +
set_nl(nl = TRUE)
)
But it gave Error: The following variables can neither be found in 'data' nor in 'data2': 'ID1'
.
Is it possible that brms
can’t cater for this specification yet?
 Operating System: 5.10.16.3microsoftstandardWSL2

brms
Version: 2.18.0