Question about sigma default prior location

I have a (probably silly) question about the default sigma prior that brms uses.

It is my understanding that the default sigma prior is a half student t distribution with 3 degrees of freedom, a location of 0, and a scale given by max(2.5, mad(y)).

However, if I sample from the prior after running the model, I don’t see that the location of the prior on sigma is 0. Instead, it seems to be shifted to the right. How does this work exactly? Is this due to the fact it is a half student-t distribution?

Below I put some code to show the prior sigma distribution after running the model.



data <- tibble(y = rnorm(100))

model <- bf(y ~ 1)

get_prior(model, data)
# default df of 3, default location of 0, default scale of max(2.5, mad(y))

fit <- brm(formula = y ~ 1, data = data, sample_prior = TRUE)

prior_samples(fit, ) %>%
  ggplot(aes(x = sigma)) + geom_density()
  • Operating System: macOS Big Sur 11.0.1 (20B29)
  • brms Version: 2.14.4

It’s just an artefact of the kernel density estimate used by geom_density. Try:

fit <- brm(formula = y ~ 1, data = data, sample_prior = TRUE, iter = 5e5, cores = 4)

prior_samples(fit, ) %>%
  ggplot(aes(x = sigma)) + 
  geom_histogram(bins = 500) +
  scale_x_continuous(limits = c(0, 5))
1 Like

Ah, that clears it up; thanks!