Note: I’ve marked @martinmodrak’s first post as the solution, but everything he wrote is very informative and helpful!
- Operating System: Windows 10
- brms Version: 2.8.0
Hey all,
I’d like some basic guidance on informative priors for a brms model of Weibull-distributed data. I’ve had trouble finding a worked example that a Bayesian neophyte like myself can understand.
I’m modeling ‘percentage of suitable habitat lost’ as a dependent variable for some arboreal lemurs. These percentages are Weibull-distributed. I’d like to know whether traits like body mass, dietary habits (i.e. frugivore, omnivore, folivore), and IUCN Red List threat level (e.g Least Concern, Endangered) are associated with habitat loss.
Onto the prior: Madagascar has lost 44% of its forest cover in the last 60 years (Vielledent et al. 2018). Therefore, I expect arboreal species to have lost at least some habitat, maybe 44% on average. However, there are other factors that can influence habitat loss like human activity and climate change. I want to set pretty weak priors since my predictors definitely do not capture all the variation.
When I learn about my prior options with get_prior, I get these defaults:
student_t(3, 0, 10) Intercept
student_t(3, 0, 10) sd
gamma(0.01, 0.01) shape
Where I get stumped is expressing my prior knowledge in this format given the weibull distribution. Why don’t I set a prior for the population-level effects? Are priors usually the same across intercepts and sd’s, or is that a coincidence? What does that shape prior mean? And finally, what would weakly informative priors for my model, given known forest loss of 44%, look like?
I really like how many assumptions are made explicit in Bayesian work, so if I’ve made some erroneous ones, please let me know! I’d love to actually understand what’s going on with brms’s defaults and how to make them work for my data.
Below please find some example code to get the default priors and the model I ultimately want to run. Thank you in advance for your time!
library(stats)
library(brms)
#make some dummy data
habitat_lost <- rweibull(n = 100, mean = 0.40, s = 0.2)
while(any(habitat_lost < 0 | habitat_lost > 1)) { habitat_lost <- rnorm(n = 100, mean = 0.4, s = 0.2) }
mass <- rnorm(n = 100, mean = 2.8, s = 0.6)
IUCN <- as.ordered(as.numeric(sample(c(1:5), 100, replace=TRUE, prob=c(0.1, 0.1, 0.2, 0.2, 0.3))))
diet <- sample(c("frugivore","omnivore","folivore"), 100, replace=TRUE, prob=c(0.35, 0.35, 0.3))
data <- as.data.frame(cbind(habitat_lost, mass, IUCN, diet))
data$mass <- as.numeric(as.character(mass))
#examine the prior options and the brms default
prior = get_prior(habitat_lost ~ mass + diet + (1|IUCN), data = data,
family = weibull())
prior
#the model I ultimately want to run, with a mildly informative prior
full_mod = brm(habitat_lost ~ logmass + diet +(1|IUCN), data = data,
family = weibull(), prior = prior, chains = 4,
iter = 110000, warmup = 10000, thin = 200)