I have the following model
bf(rel_size ~ eta,
nlf(eta ~ A + K * inv_logit(-exp(slope) *(log10(dose) - gamma) ) ),
A ~ 0 + insect + (1|qq|experiment),
K ~ 0 + insect + (1|qq|experiment),
slope ~ 0 + insect + (1|qq|experiment),
gamma ~ 0 + insect + offset(delta) + (1|qq|experiment),
nl = TRUE)
However I have data where dose
is 0, which causes gradients to explode. For this particular model the likelihood is well defined as dose → 0 (eta → A + K). When I have written such a model in pure stan (without the grouping effects) I write something like this
...
// compute non-linear predictor values
if (dose[n] == 0){
mu[n] = A + K;
}else{
mu[n] = A + K / (1 + exp( exp(slope) * (log10(dose[n]) - gamma)));
}
}
...
How would I achieve something similar with brms? One way would be if one could provide multiple models to brms with shared parameters, but I don’t think thats currently possible? Is there any other way?