# brms

**URL:** https://discourse.mc-stan.org/c/interfaces/brms/36.md

[Latest](https://discourse.mc-stan.org/latest.md) · [Categories](https://discourse.mc-stan.org/categories.md) · [Tags](https://discourse.mc-stan.org/tags.md)

---

## [About the brms category](https://discourse.mc-stan.org/t/about-the-brms-category/3890)

<div class="topic-metadata">

**Author:** [@jonah](https://discourse.mc-stan.org/u/jonah)\
**Replies:** 1\
**Last updated:** [July 26, 2022, 10:12pm UTC](https://discourse.mc-stan.org/t/about-the-brms-category/3890 "2022-07-26T22:12:30Z")

</div>

This category is for questions regarding the installation and use of brms. If you have installation issues then please provide as much information about your system as possible.

---

## [How can I use the same function call to sample from posterior when data exists and only sample from prior when not?](https://discourse.mc-stan.org/t/how-can-i-use-the-same-function-call-to-sample-from-posterior-when-data-exists-and-only-sample-from-prior-when-not/41685)

<div class="topic-metadata">

**Author:** [@ischmidt20](https://discourse.mc-stan.org/u/ischmidt20)\
**Replies:** 5\
**Last updated:** [October 24, 2026, 2:35am UTC](https://discourse.mc-stan.org/t/how-can-i-use-the-same-function-call-to-sample-from-posterior-when-data-exists-and-only-sample-from-prior-when-not/41685 "2026-10-24T02:35:22Z")

</div>

I have a brms model where sometimes there is no data, in which case I want brms to sample from the prior just as it normally would the posterior. Previously, I had code like this: cond \<- ... if (sum(cond) == 0) { s…

---

## [How to calculate phylogenetic signal for a varying slopes model?](https://discourse.mc-stan.org/t/how-to-calculate-phylogenetic-signal-for-a-varying-slopes-model/32683)

<div class="topic-metadata">

**Author:** [@daSilva5](https://discourse.mc-stan.org/u/daSilva5)\
**Replies:** 3\
**Last updated:** [October 11, 2026, 1:15am UTC](https://discourse.mc-stan.org/t/how-to-calculate-phylogenetic-signal-for-a-varying-slopes-model/32683 "2026-10-11T01:15:34Z")

</div>

Short summary of the problem I would like to know how to calculate the phylogenetic signal for models with varying slopes and intercepts. Following from https://cran.r-project.org/web/packages/brms/vignettes/brms\_phylog…

---

## [Help testing brms pr for sum-to-zero and partial centering](https://discourse.mc-stan.org/t/help-testing-brms-pr-for-sum-to-zero-and-partial-centering/41542)

<div class="topic-metadata">

**Author:** [@spinkney](https://discourse.mc-stan.org/u/spinkney)\
**Replies:** 43\
**Last updated:** [September 18, 2026, 9:39am UTC](https://discourse.mc-stan.org/t/help-testing-brms-pr-for-sum-to-zero-and-partial-centering/41542 "2026-09-18T09:39:05Z")

</div>

Hi brms users, I’m hoping to get eyes on this pr Add fast sum-to-zero parameterizations for group effects by spinkney · Pull Request #1919 · paul-buerkner/brms · GitHub Warnings, it is large and it is AI generated becau…

---

## [Understanding sample\_new\_levels = "uncertainty", "gaussian", and "old\_levels"](https://discourse.mc-stan.org/t/understanding-sample-new-levels-uncertainty-gaussian-and-old-levels/7828)

<div class="topic-metadata">

**Author:** [@AntonioV](https://discourse.mc-stan.org/u/AntonioV)\
**Replies:** 19\
**Last updated:** [September 7, 2026, 12:27pm UTC](https://discourse.mc-stan.org/t/understanding-sample-new-levels-uncertainty-gaussian-and-old-levels/7828 "2026-09-07T12:27:17Z")

</div>

The documentation for brms::extract\_draws() says this about the sample\_new\_levels option: Indicates how to sample new levels for grouping factors specified in re\_formula. This argument is only relevant if newdata is pr…

---

## [Shape constrained (e.g., monotonic) smooths in brms](https://discourse.mc-stan.org/t/shape-constrained-e-g-monotonic-smooths-in-brms/7128)

<div class="topic-metadata">

**Author:** [@tiflo](https://discourse.mc-stan.org/u/tiflo)\
**Replies:** 17\
**Last updated:** [September 4, 2026, 8:56am UTC](https://discourse.mc-stan.org/t/shape-constrained-e-g-monotonic-smooths-in-brms/7128 "2026-09-04T08:56:02Z")

</div>

I was delighted to see that brms allows shape constrained smooths as from the scam package as part of its formula syntax. However, the post-processing such as marginal\_effects() does not seem to work. I found this old po…

---

## [Posterior distribution and heterogeneity in Bayesian three-level meta-analysis with brms](https://discourse.mc-stan.org/t/posterior-distribution-and-heterogeneity-in-bayesian-three-level-meta-analysis-with-brms/41451)

<div class="topic-metadata">

**Author:** [@Yuanyuan](https://discourse.mc-stan.org/u/Yuanyuan)\
**Replies:** 0\
**Last updated:** [July 21, 2026, 10:29am UTC](https://discourse.mc-stan.org/t/posterior-distribution-and-heterogeneity-in-bayesian-three-level-meta-analysis-with-brms/41451 "2026-07-21T10:29:36Z")

</div>

Hi, As a beginner, I am trying to do a Bayesian three-level meta-analysis with brms. Following the https://doing-meta.guide/bayesian-ma , here is the code for my main model. #Main model main.model \<- brm(yi|se(seTE)~ …

---

## [Lognormal family in brms](https://discourse.mc-stan.org/t/lognormal-family-in-brms/41429)

<div class="topic-metadata">

**Author:** [@Hunter24](https://discourse.mc-stan.org/u/Hunter24)\
**Replies:** 4\
**Last updated:** [July 16, 2026, 6:25pm UTC](https://discourse.mc-stan.org/t/lognormal-family-in-brms/41429 "2026-07-16T18:25:17Z")

</div>

I simulated lognormal data, where the variation on the log scale is constant which I believe represents the lognormal family assumptions in brms. When I simulated this data I recovered all parameters almost exactly, but…

---

## ["get\_prior() shows only one group random intercept prior when using gr(by = ...), shouldn't there be two as this model assumes groups being drawn from separate distributions?"](https://discourse.mc-stan.org/t/get-prior-shows-only-one-group-random-intercept-prior-when-using-gr-by-shouldnt-there-be-two-as-this-model-assumes-groups-being-drawn-from-separate-distributions/41428)

<div class="topic-metadata">

**Author:** [@hunter\_warick](https://discourse.mc-stan.org/u/hunter_warick)\
**Replies:** 0\
**Last updated:** [July 8, 2026, 7:53am UTC](https://discourse.mc-stan.org/t/get-prior-shows-only-one-group-random-intercept-prior-when-using-gr-by-shouldnt-there-be-two-as-this-model-assumes-groups-being-drawn-from-separate-distributions/41428 "2026-07-08T07:53:22Z")

</div>

Short summary of the problem brm.formula.1 \<- bf( y ~ 0 + group+ # Group-specific independent random intercepts (1 | gr(ID, by = group)), sigma ~ 0 + group ) prior\_1 \<- # coefficients prior(normal(l…

---

## [Why does changing the reference level wildly change the predicted probabilities?](https://discourse.mc-stan.org/t/why-does-changing-the-reference-level-wildly-change-the-predicted-probabilities/41399)

<div class="topic-metadata">

**Author:** [@FeliOtte](https://discourse.mc-stan.org/u/FeliOtte)\
**Replies:** 1\
**Last updated:** [June 26, 2026, 2:21pm UTC](https://discourse.mc-stan.org/t/why-does-changing-the-reference-level-wildly-change-the-predicted-probabilities/41399 "2026-06-26T14:21:31Z")

</div>

Hello everyone, I’m having some modelling issues and I’m hoping the answer to the question above might help. I am running a multinomial/categorical model in brms and am getting results that do not make sense for my data…

---

## [Assessing influence of population-level predictors on one specific trial](https://discourse.mc-stan.org/t/assessing-influence-of-population-level-predictors-on-one-specific-trial/41396)

<div class="topic-metadata">

**Author:** [@IreneSophia](https://discourse.mc-stan.org/u/IreneSophia)\
**Replies:** 1\
**Last updated:** [June 25, 2026, 9:00am UTC](https://discourse.mc-stan.org/t/assessing-influence-of-population-level-predictors-on-one-specific-trial/41396 "2026-06-25T09:00:54Z")

</div>

I have an experimental design with one between-subjects factor (gender, 2 levels) and one within-subjects factor (cond, 2 levels). Each subject encounters multiple trials. The data is ordinal and I am using brms to const…

---

## [Understanding the Likelihood Model for the Cox Family in brms](https://discourse.mc-stan.org/t/understanding-the-likelihood-model-for-the-cox-family-in-brms/40622)

<div class="topic-metadata">

**Author:** [@kaybenleroll](https://discourse.mc-stan.org/u/kaybenleroll)\
**Replies:** 5\
**Last updated:** [June 16, 2026, 8:50pm UTC](https://discourse.mc-stan.org/t/understanding-the-likelihood-model-for-the-cox-family-in-brms/40622 "2026-06-16T20:50:28Z")

</div>

I am trying to understand the basic approach of the cox() family in brms. My understanding was that the idea is to model the baseline rate as a spline using the spline2 package, and then the covariates are proportional h…

---

## [Calculate indirect effects for a longitudinal Gaussian Process mediation model](https://discourse.mc-stan.org/t/calculate-indirect-effects-for-a-longitudinal-gaussian-process-mediation-model/41294)

<div class="topic-metadata">

**Author:** [@drnight](https://discourse.mc-stan.org/u/drnight)\
**Replies:** 1\
**Last updated:** [May 25, 2026, 12:24pm UTC](https://discourse.mc-stan.org/t/calculate-indirect-effects-for-a-longitudinal-gaussian-process-mediation-model/41294 "2026-05-25T12:24:09Z")

</div>

Hello, I am running a longitudinal mediation model with both the independent and the mediatior variables being time-varying (for 6 time points), using Gaussian Process in brms. Would be grateful if anyone could help me…

---

## [Longitudinal Mediation with only two time points](https://discourse.mc-stan.org/t/longitudinal-mediation-with-only-two-time-points/41239)

<div class="topic-metadata">

**Author:** [@drnight](https://discourse.mc-stan.org/u/drnight)\
**Replies:** 0\
**Last updated:** [May 15, 2026, 9:01pm UTC](https://discourse.mc-stan.org/t/longitudinal-mediation-with-only-two-time-points/41239 "2026-05-15T21:01:07Z")

</div>

I am doing longitudinal mediation analysis with brms. Previous suggestions include the use of splines and Gaussian process. However, because I’m only considering two time points (baseline and end-of-treatment), I am not …

---

## [Evidence ratios when using default priors](https://discourse.mc-stan.org/t/evidence-ratios-when-using-default-priors/4847)

<div class="topic-metadata">

**Author:** [@ivan\_grahek](https://discourse.mc-stan.org/u/ivan_grahek)\
**Replies:** 12\
**Last updated:** [April 29, 2026, 4:12am UTC](https://discourse.mc-stan.org/t/evidence-ratios-when-using-default-priors/4847 "2026-04-29T04:12:20Z")

</div>

Hi, I have fitted a multilevel model with an interaction between three factors (3X2X2 factorial design, predicting EEG amplitudes with several experimental conditions, i.e., categorical variables) with varying slopes an…

---

## [Mean-centered variables in brms](https://discourse.mc-stan.org/t/mean-centered-variables-in-brms/41064)

<div class="topic-metadata">

**Author:** [@REYZ](https://discourse.mc-stan.org/u/REYZ)\
**Replies:** 4\
**Last updated:** [April 24, 2026, 1:43pm UTC](https://discourse.mc-stan.org/t/mean-centered-variables-in-brms/41064 "2026-04-24T13:43:27Z")

</div>

Hello! I am trying to model a behavioral task using brms. There are two independent variables (each with two levels), and I am interested mostly in the interaction effect (var1\*var2). Task responses were made on a discr…

---

## [Add\_criterion applied to a model produced by brm()](https://discourse.mc-stan.org/t/add-criterion-applied-to-a-model-produced-by-brm/41037)

<div class="topic-metadata">

**Author:** [@JKingston](https://discourse.mc-stan.org/u/JKingston)\
**Replies:** 3\
**Last updated:** [April 9, 2026, 3:26pm UTC](https://discourse.mc-stan.org/t/add-criterion-applied-to-a-model-produced-by-brm/41037 "2026-04-09T15:26:43Z")

</div>

Please share your Stan program and accompanying data if possible. I am trying to use add\_criterion() to add “loo” to a model created with brm(), so that I can use loo\_compare() to compared models. add\_criterion() appea…

---

## [Hierarchical graded IRT](https://discourse.mc-stan.org/t/hierarchical-graded-irt/23606)

<div class="topic-metadata">

**Author:** [@saschagobel](https://discourse.mc-stan.org/u/saschagobel)\
**Replies:** 9\
**Last updated:** [March 25, 2026, 11:54am UTC](https://discourse.mc-stan.org/t/hierarchical-graded-irt/23606 "2026-03-25T11:54:13Z")

</div>

Hi all, Is there a way to fit a hierarchical graded IRT model with brms where both the mean and the variance of the ability parameter may depend on covariates? The goal here is to get subgroup-specific (defined by covar…

---

## [Censored responses multivariate model](https://discourse.mc-stan.org/t/censored-responses-multivariate-model/9772)

<div class="topic-metadata">

**Author:** [@millerp](https://discourse.mc-stan.org/u/millerp)\
**Replies:** 4\
**Last updated:** [March 17, 2026, 3:13pm UTC](https://discourse.mc-stan.org/t/censored-responses-multivariate-model/9772 "2026-03-17T15:13:01Z")

</div>

I can’t find any examples, but brms has so many (awesome!) features that I may have missed it. I want to model protein concentrations for many different proteins measured on the same samples. I would prefer a multivaria…

---

## [Different amounts of data in different conditions](https://discourse.mc-stan.org/t/different-amounts-of-data-in-different-conditions/40954)

<div class="topic-metadata">

**Author:** [@FeliOtte](https://discourse.mc-stan.org/u/FeliOtte)\
**Replies:** 3\
**Last updated:** [March 12, 2026, 10:54am UTC](https://discourse.mc-stan.org/t/different-amounts-of-data-in-different-conditions/40954 "2026-03-12T10:54:01Z")

</div>

Hi everyone, I’m running a super basic brms model that looks like this (leaving out technical specifications like chains, iterations etc.): brm(categorical outcome variable ~ binomial predictor + (1|participants), data,…

---

## [Error in sink(type = "output") : invalid connection on Mac OS](https://discourse.mc-stan.org/t/error-in-sink-type-output-invalid-connection-on-mac-os/26117)

<div class="topic-metadata">

**Author:** [@jaredv](https://discourse.mc-stan.org/u/jaredv)\
**Replies:** 9\
**Last updated:** [March 2, 2026, 5:26pm UTC](https://discourse.mc-stan.org/t/error-in-sink-type-output-invalid-connection-on-mac-os/26117 "2026-03-02T17:26:56Z")

</div>

Hello, I have recently started using a new computer (Mac OS 12.2, R 4.1.2, brms 2.16.3). In my first session using R on the new computer, I receive first a pop-up message asking if I would “like to install build tools.…

---

## [How can I found the appropriate family to fit my data using brms?](https://discourse.mc-stan.org/t/how-can-i-found-the-appropriate-family-to-fit-my-data-using-brms/40919)

<div class="topic-metadata">

**Author:** [@dmaria](https://discourse.mc-stan.org/u/dmaria)\
**Replies:** 1\
**Last updated:** [February 11, 2026, 7:13pm UTC](https://discourse.mc-stan.org/t/how-can-i-found-the-appropriate-family-to-fit-my-data-using-brms/40919 "2026-02-11T19:13:13Z")

</div>

Hello, everyone. I have a set of data from dose-response effect (without saturation point), but I don’t know how to fit it with appropriate family. I have values that follows a log distribution, however, there are some …

---

## [How to handle log concentration monotonic effects](https://discourse.mc-stan.org/t/how-to-handle-log-concentration-monotonic-effects/40909)

<div class="topic-metadata">

**Author:** [@dmaria](https://discourse.mc-stan.org/u/dmaria)\
**Replies:** 1\
**Last updated:** [February 10, 2026, 1:53pm UTC](https://discourse.mc-stan.org/t/how-to-handle-log-concentration-monotonic-effects/40909 "2026-02-10T13:53:45Z")

</div>

My data consist of signal from diff log concentrarion = -7…-2 -2 the highest, shall I reorder to remove the negative symbol? and some values are negative but the distribution is fairly a log one, what other family can …

---

## [Projpred - model with horseshoe prior does not converge](https://discourse.mc-stan.org/t/projpred-model-with-horseshoe-prior-does-not-converge/29935)

<div class="topic-metadata">

**Author:** [@Jacquie](https://discourse.mc-stan.org/u/Jacquie)\
**Replies:** 13\
**Last updated:** [February 5, 2026, 4:26pm UTC](https://discourse.mc-stan.org/t/projpred-model-with-horseshoe-prior-does-not-converge/29935 "2026-02-05T16:26:40Z")

</div>

This is my first time trying to use regularised regressions. I have two data sets. I want to build a predictive model (with cross validation) on the first and then validate on the second data set. In the first data set, …

---

## [Power analysis for ordinal phylogenetic model](https://discourse.mc-stan.org/t/power-analysis-for-ordinal-phylogenetic-model/40883)

<div class="topic-metadata">

**Author:** [@Hanz](https://discourse.mc-stan.org/u/Hanz)\
**Replies:** 1\
**Last updated:** [January 31, 2026, 6:28pm UTC](https://discourse.mc-stan.org/t/power-analysis-for-ordinal-phylogenetic-model/40883 "2026-01-31T18:28:49Z")

</div>

Hello, We were asked to provide the statistical power of our ordinal model. Initially, we did not find evidence for any effects and because the sample size is small (n = 36), the model may have low power to reveal any e…

---

## [Vector Autoregressive Structure](https://discourse.mc-stan.org/t/vector-autoregressive-structure/40862)

<div class="topic-metadata">

**Author:** [@cMiIIer](https://discourse.mc-stan.org/u/cMiIIer)\
**Replies:** 3\
**Last updated:** [January 31, 2026, 10:49am UTC](https://discourse.mc-stan.org/t/vector-autoregressive-structure/40862 "2026-01-31T10:49:22Z")

</div>

Hello! As part of my thesis, I conducted a mesocosm experiment using a community of organisms and we are curious about how the community we curated performed. As a part of it I am trying to fit each trophic level into a…

---

## [Error when loading premade priors](https://discourse.mc-stan.org/t/error-when-loading-premade-priors/40880)

<div class="topic-metadata">

**Author:** [@pnt](https://discourse.mc-stan.org/u/pnt)\
**Replies:** 0\
**Last updated:** [January 30, 2026, 11:12am UTC](https://discourse.mc-stan.org/t/error-when-loading-premade-priors/40880 "2026-01-30T11:12:36Z")

</div>

Hey, I get the following error message when running brms models with a CSC supercomputer. I am running a R script and I load the priors into the script with load(Priors.RData). Error in rbind(deparse.level, ...) : n…

---

## [Binomial GLMM Assumptions](https://discourse.mc-stan.org/t/binomial-glmm-assumptions/30254)

<div class="topic-metadata">

**Author:** [@Hunter24](https://discourse.mc-stan.org/u/Hunter24)\
**Replies:** 15\
**Last updated:** [January 28, 2026, 6:40pm UTC](https://discourse.mc-stan.org/t/binomial-glmm-assumptions/30254 "2026-01-28T18:40:27Z")

</div>

I am using a binomial GLMM and am confused on how to test for homoscedasticity of residuals. When I use normal difference residuals it shows heteroscedasticity, but when I use pearsons residuals it shows more of a homos…

---

## [Combining spatial and within variability, and biasing representative latent variable](https://discourse.mc-stan.org/t/combining-spatial-and-within-variability-and-biasing-representative-latent-variable/40845)

<div class="topic-metadata">

**Author:** [@TSThum](https://discourse.mc-stan.org/u/TSThum)\
**Replies:** 4\
**Last updated:** [January 20, 2026, 3:44pm UTC](https://discourse.mc-stan.org/t/combining-spatial-and-within-variability-and-biasing-representative-latent-variable/40845 "2026-01-20T15:44:49Z")

</div>

Hi all, I am still learning how to formulate models in brms (and lme4 syntax generally), so any help would be greatly appreciated. I am trying to model the following relationship: q\_z~N(q\_CPT,sig\_within) #within-CPT va…

---

## [Unexpected behavior of \`fitted\` function with distributional model](https://discourse.mc-stan.org/t/unexpected-behavior-of-fitted-function-with-distributional-model/40847)

<div class="topic-metadata">

**Author:** [@lamonica-d](https://discourse.mc-stan.org/u/lamonica-d)\
**Replies:** 0\
**Last updated:** [January 20, 2026, 11:27am UTC](https://discourse.mc-stan.org/t/unexpected-behavior-of-fitted-function-with-distributional-model/40847 "2026-01-20T11:27:23Z")

</div>

I’m using a Gaussian distributional model to describe the distribution of a certain trait response in individual plant within species. I kept the structure and data quantity to a minimum for the reproducible example. Dat…

[Next page](https://discourse.mc-stan.org/c/interfaces/brms/36.md?page=1)
