Oh, maybe I’ve found something wrong. It is to do with the model specification:
prior1 <- prior(normal(14, 1), nlpar = "top") +
prior(normal(8.0, 1), nlpar = "bottom")+
prior(normal(0.2, 0.1), nlpar = "rate")+
prior(normal(2, 1), nlpar = "KG5" )
# prior(normal(0.5, 1), nlpar = "Group" )+
fit1 <- brm(bf(Response ~ top - ((top-bottom)*exp(-rate * Treatment)) + KG5,
top + bottom + rate ~ 1,
KG5 ~ 1 + Control, # < change here, now can add factor
nl = TRUE), # drawing from "control" column
data = SynthData,
prior = prior1,
#family = cumulative(link="logit", threshold="flexible"),
iter = 4000 , warmup = 2000, thin = 2,
chains = 4, cores=6,
init = init_list,
control = control,
#file = "./model/fit14"
)
Visualize
testPred <- predict(
fit1,
type = "response")
SynthData$Estimate <- testPred[,1]
#Visualize
ggplot(SynthData, aes(x=Treatment, y= Response))+
geom_point(aes(color = Group, shape = Control))+
geom_point(aes(x=Treatment, y=Estimate, color = Group, shape = Control), size = 6)+
theme_bw()
So i can now see the control group correctly fitting.
My knowledge on formulating these BRMS models is a bit hit and miss. Does anyone know of a good resource that tackles this in a systematic way?
Thomas
