I would like to fit a nonlinear mixed model (fitted with the R package nlme) in the R package brms.
I am unsure about the correct syntax. The NLME model is fitted using a self-start function (SS3PL) and a three-parameter logistic model:
y_{ijk} = \frac{\phi_{2i}}{1\ +\ exp(\phi_{1i}\ (x_{ijk} - \phi_{3ij}))} + \varepsilon_{ijk},
where i is the indiviual ID, j the number of measurement occasion and k the treatment group (binary) . All three parameters are included as random effects.
The parameters \phi_{3} (D50), \phi_{2} (upper asymptote) and \phi_{1} (slope) vary per individual, but \phi_{3} also varies per treatment group on the population level.
The nlme model is implemented like this:
NLME_model <- nlme(y~ SS3PL(x, phi2, phi3, phi1),
data = daten,
fixed = list(phi2 + phi1 ~ 1, phi3 ~ Subgruppen), # variation of phi3 (fixed effect) among treatment groups
groups = ~ Name, # random variation in phi1, phi2, phi3
start = list(fixed = c(40, 0.1, 87, 0)))
I specified this model in brms like this, but the results aren’t convincing, which is why I would like to know if the specification is correct.
bay_model <- bf(y~ phi2/(1 + exp(phi1 * (x- phi3)))
phi1 ~ 1 + (1 | Name)
phi2 ~ 1 + (1 | Name)
phi3 ~ 1 + Subgruppen + (1 | Name),
nl = T)
Thank you for your help.