Hello everyone,

I probably have another silly question for you. I am trying to teach myself Bayesian statistics and I have run into something that I do not quite understand.

I have simulated some data (rnorm(352, mean = 155, sd = 10)) to which I apply two simple intercept-only models. In the first model, I use the default brms priors and in the second model I use a stricter prior for sigma. Yet, in the output, the estimates for sigma seem to be unaffected by the stricter prior on sigma, as seen in this graph:

question_priors_posteriors.pdf (10.4 KB)

Why is this the case? Could it be due to the prior on the intercept?

Here is the exact code I used:

```
library(brms)
library(tidyverse)
# Simulate data
set.seed(4)
data <- tibble(x = rnorm(352, mean = 155, sd = 10))
# Run model 1, the default brms model
model_default <- brm(
x ~ 1,
data = data,
family = gaussian,
prior = c(
prior(student_t(3, 154.6, 10), class = "Intercept"),
prior(student_t(3, 0, 10), class = "sigma")
),
cores = 4,
seed = 4,
sample_prior = TRUE,
)
# Run model 2 with a smaller sigma in the student_t prior for sigma
model_stricter_sigma <- brm(
x ~ 1,
data = data,
family = gaussian,
prior = c(
prior(student_t(3, 154.6, 10), class = "Intercept"),
prior(student_t(3, 0, 1), class = "sigma")
),
cores = 4,
seed = 4,
sample_prior = TRUE,
)
# Look at model output
model_default
model_stricter_sigma
# Visualize priors and posteriors
results_default <- model_default %>%
posterior_samples() %>%
select(ends_with("sigma")) %>%
pivot_longer(cols = everything()) %>%
mutate(
model = "default",
name = if_else(str_detect(name, "prior"), "prior", "posterior")
)
results_strict <- model_stricter_sigma %>%
posterior_samples() %>%
select(ends_with("sigma")) %>%
pivot_longer(cols = everything()) %>%
mutate(
model = "strict",
name = if_else(str_detect(name, "prior"), "prior", "posterior")
)
results <- bind_rows(results_default, results_strict)
ggplot(results, aes(x = value, fill = name)) +
geom_histogram(binwidth = 0.1) +
facet_wrap(~ model, ncol = 1) +
coord_cartesian(xlim = c(0, 20))
```

- Operating System: macOS Big Sur (latest)
- brms Version: 2.14.4