Hi everyone,
I hope this is the right venue to ask this question, let me know if I should ask it somewhere more bambi-specific!
My question is pretty simple: I’d like to compare some of the estimates I get with bambi with other mixed model libraries such as R’s lme4
. However, when I see differences, I’m not sure whether they’re just due to the default priors in bambi. To remove this effect, I’d like to drop the weakly informative priors in bambi, and opt for flat priors everywhere. Would there be an easy way to do this? Obviously I realise the priors are there for a reason, but as I mentioned, for this specific comparison it would be helpful for me to disable them.
Thanks for your help 
Martin
1 Like
Hi @Martin_Ingram!
Something like this should make the job:
import bambi as bmb
data = bmb.load_data("sleepstudy")
priors = {
# Common (aka fixed effects)
"common": bmb.Prior("Flat"),
# Group specific (aka random effects)
"group_specific": bmb.Prior("Flat"),
# Auxiliary parameters
"sigma": bmb.Prior("Flat")
}
model = bmb.Model("Reaction ~ 1 + Days + (Days | Subject)", data, priors=priors, categorical="Subject")
However, internally Bambi checks that priors passed to group-specific effects have hyperpriors, which is not the case here. And I think that means we cannot pass flat priors for group-specific effects. To make the code above work you need to remove the "group_specific"
entry from the priors
dictionary.
To make it closer to the frequentist alternative, you could do:
priors = {
# Common (aka fixed effects)
"common": bmb.Prior("Flat"),
# Group specific (aka random effects)
"group_specific": bmb.Prior("Normal", sigma=bmb.Prior("Flat")),
# Auxiliary parameters
"sigma": bmb.Prior("Flat")
}
model = bmb.Model("Reaction ~ 1 + Days + (Days | Subject)", data, priors=priors, categorical="Subject")