# Plotting priors for conditional effects

**URL:** <https://discourse.mc-stan.org/t/plotting-priors-for-conditional-effects/40447>\
**Category:** brms\
**Tags:** brms\
**Created:** [October 3, 2025, 11:54am UTC](https://discourse.mc-stan.org/t/plotting-priors-for-conditional-effects/40447 "2025-10-03T11:54:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![digikar](https://avatars.discourse-cdn.com/v4/letter/d/49beb7/32.png) [@digikar](https://discourse.mc-stan.org/u/digikar)\
**Post date:** [October 3, 2025, 11:54am UTC](https://discourse.mc-stan.org/t/plotting-priors-for-conditional-effects/40447/1 "2025-10-03T11:54:15Z")

</div>

I am getting started with bayesian analysis, so let me know if my question does not make sense. I’m using brms, and I want to plot the priors for my conditional effects.

This much is okay:

```R
# Fit the model
my.brms.model.fit <- brm(eff ~ fct1 * fct2 + (1 | subject_id),
                         data = my.data)

# Display the final estimates for the regression coefficients
summary(my.brms.model.fit)

# Plot the final estimates for conditional effects, example:
plot(conditional_effects(my.brms.model.fit,
                         effects = "fct1",
                         conditions = data.frame(fct2 = c("fc2.level1"))))

# Display the priors for the regression coefficients
prior_summary(my.brms.model.fit)

```

However, how do I plot the priors for my conditional effects?

```R
# This fails with no applicable method for 'conditional_effects' 
# applied to an object of class "c('brmsprior', 'data.frame')"
plot(conditional_effects(prior_summary(my.brms.model.fit)))

```

How do I achieve this?

Another way I guessed could be to supply empty data:

```R
my.brms.model.fit <- brm(eff ~ fct1 * fct2 + (1 | subject_id),
                         data = my.data %>% filter(fct1 == ''))

```

But that gives me the error `Argument 'data' does not contain observations.`

* * *

- Operating System: Linux / Ubuntu 24.04 VM
- brms Version: 2.23.0

---

<div class="post-metadata">

**Author:** ![amynang](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/amynang/32/19114_2.png) [@amynang](https://discourse.mc-stan.org/u/amynang)\
**Post date:** [October 3, 2025, 1:57pm UTC](https://discourse.mc-stan.org/t/plotting-priors-for-conditional-effects/40447/2 "2025-10-03T13:57:30Z")

</div>

`brm` has the argument `sample_prior`. After fitting a model with sample\_prior = “only”, you can use `conditional_effects` like you wanted:

`conditional_effects(my.prior.only.fit)`

see also `?brm` for more details on the sample\_prior argument.

---

<div class="post-metadata">

**Author:** ![Solomon](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/solomon/32/2495_2.png) [@Solomon](https://discourse.mc-stan.org/u/Solomon)\
**Post date:** [October 3, 2025, 2:15pm UTC](https://discourse.mc-stan.org/t/plotting-priors-for-conditional-effects/40447/3 "2025-10-03T14:15:00Z")

</div>

This is the way

---

<div class="post-metadata">

**Author:** ![digikar](https://avatars.discourse-cdn.com/v4/letter/d/49beb7/32.png) [@digikar](https://discourse.mc-stan.org/u/digikar)\
**Post date:** [October 3, 2025, 2:44pm UTC](https://discourse.mc-stan.org/t/plotting-priors-for-conditional-effects/40447/4 "2025-10-03T14:44:57Z")

</div>

Great, I can play around with that!

The default improper priors do pose a problem:

```no-highlight
Sampling from priors is not possible as some parameters have no proper priors.

```

But I think I can fix that.

Thanks!
