# \#hierarchical-model

**URL:** https://discourse.mc-stan.org/tag/hierarchical-model/112.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)

---

## [Open data and brms code for soil carbon spectroscopy prediction](https://discourse.mc-stan.org/t/open-data-and-brms-code-for-soil-carbon-spectroscopy-prediction/41667)

<div class="topic-metadata">

**Author:** [@potash](https://discourse.mc-stan.org/u/potash)\
**Replies:** 22\
**Last updated:** [November 13, 2026, 9:09pm UTC](https://discourse.mc-stan.org/t/open-data-and-brms-code-for-soil-carbon-spectroscopy-prediction/41667 "2026-11-13T21:09:07Z")

</div>

We just published a paper in the European Journal of Soil Science using Stan to fit a spectroscopy prediction model. Code and data using brms and targets is here. In this problem the predictor is a spectroscopy scan, e.…

---

## [Bmm 1.4.1: signal detection and MPT models on CRAN](https://discourse.mc-stan.org/t/bmm-1-4-1-signal-detection-and-mpt-models-on-cran/41683)

<div class="topic-metadata">

**Author:** [@g.frischkorn](https://discourse.mc-stan.org/u/g.frischkorn)\
**Replies:** 2\
**Last updated:** [October 19, 2026, 6:32pm UTC](https://discourse.mc-stan.org/t/bmm-1-4-1-signal-detection-and-mpt-models-on-cran/41683 "2026-10-19T18:32:29Z")

</div>

bmm (Bayesian Measurement Modeling) fits hierarchical measurement models of cognition through brms and Stan. Version 1.4.1 adds signal detection theory models for yes/no, m-AFC, ranking, confidence-rating (with dual-proc…

---

## [A faster implementation of hierarchical models](https://discourse.mc-stan.org/t/a-faster-implementation-of-hierarchical-models/41120)

<div class="topic-metadata">

**Author:** [@Rick\_RS95](https://discourse.mc-stan.org/u/Rick_RS95)\
**Replies:** 22\
**Last updated:** [May 20, 2026, 11:34am UTC](https://discourse.mc-stan.org/t/a-faster-implementation-of-hierarchical-models/41120 "2026-05-20T11:34:22Z")

</div>

Hi all! I am sure many of you know useful tricks to make hierarchical models fit faster. I have been trying different things for a while, and I would like to share a specification that is very fast and that, as far as I…

---

## [Using Hierarchical mean estimates as predictors](https://discourse.mc-stan.org/t/using-hierarchical-mean-estimates-as-predictors/40969)

<div class="topic-metadata">

**Author:** [@E\_michels](https://discourse.mc-stan.org/u/E_michels)\
**Replies:** 8\
**Last updated:** [March 25, 2026, 4:19am UTC](https://discourse.mc-stan.org/t/using-hierarchical-mean-estimates-as-predictors/40969 "2026-03-25T04:19:37Z")

</div>

Hi everyone, I’m trying to build a model that propagates uncertainty across several linked components (possibly something like a Bayesian path model / SEM). Below is a simplified version of the full model, which is beha…

---

## [Two-part mixture model on left-censored biomarker data](https://discourse.mc-stan.org/t/two-part-mixture-model-on-left-censored-biomarker-data/40899)

<div class="topic-metadata">

**Author:** [@Biomarker\_Researcher](https://discourse.mc-stan.org/u/Biomarker_Researcher)\
**Replies:** 12\
**Last updated:** [February 19, 2026, 3:39pm UTC](https://discourse.mc-stan.org/t/two-part-mixture-model-on-left-censored-biomarker-data/40899 "2026-02-19T15:39:07Z")

</div>

I am trying to model blood biomarker data collected longitudinally in a sample of patients vs. controls. There are 4 sampling timepoints, with patient data collected either at timepoint 1 or 2 (I have considered combinin…

---

## [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…

---

## [Performing posterior predictive checks for variational inference models](https://discourse.mc-stan.org/t/performing-posterior-predictive-checks-for-variational-inference-models/40742)

<div class="topic-metadata">

**Author:** [@jr-leary7](https://discourse.mc-stan.org/u/jr-leary7)\
**Replies:** 4\
**Last updated:** [December 21, 2025, 9:26pm UTC](https://discourse.mc-stan.org/t/performing-posterior-predictive-checks-for-variational-inference-models/40742 "2025-12-21T21:26:18Z")

</div>

Hi all, Apologies in advance for the long post - feel free to jump to the Questions section at the end. Background Over the past year or so I’ve been working on developing a hierarchical approximate Gaussian process (…

---

## [Why are MAP estimates far from true value in polytomous CDM with latent-class mixture? (Beginner question)](https://discourse.mc-stan.org/t/why-are-map-estimates-far-from-true-value-in-polytomous-cdm-with-latent-class-mixture-beginner-question/40728)

<div class="topic-metadata">

**Author:** [@gleonxu](https://discourse.mc-stan.org/u/gleonxu)\
**Replies:** 3\
**Last updated:** [December 11, 2025, 4:21pm UTC](https://discourse.mc-stan.org/t/why-are-map-estimates-far-from-true-value-in-polytomous-cdm-with-latent-class-mixture-beginner-question/40728 "2025-12-11T16:21:30Z")

</div>

Hi everyone, I’m new to Stan and mixture models. I’m fitting a polytomous cognitive diagnosis model (DINA-like) where latent attribute mastery patterns are explicitly enumerated: C = 2^K and the likelihood is a mixtur…

---

## [Varying highly correlated slopes: between-group variation collapses to zero, poor convergence](https://discourse.mc-stan.org/t/varying-highly-correlated-slopes-between-group-variation-collapses-to-zero-poor-convergence/40664)

<div class="topic-metadata">

**Author:** [@potash](https://discourse.mc-stan.org/u/potash)\
**Replies:** 1\
**Last updated:** [December 5, 2025, 7:17pm UTC](https://discourse.mc-stan.org/t/varying-highly-correlated-slopes-between-group-variation-collapses-to-zero-poor-convergence/40664 "2025-12-05T19:17:33Z")

</div>

I have a regression model with 32 predictors and RW prior on the slopes (more details below) that works well and add varying intercepts-- it works well. But when I let slopes vary (group slopes = global RW plus group-sp…

---

## [Consistent errors (bias) in retrodiction/parameter recovery of a single parameter in a multilevel gamma model](https://discourse.mc-stan.org/t/consistent-errors-bias-in-retrodiction-parameter-recovery-of-a-single-parameter-in-a-multilevel-gamma-model/34711)

<div class="topic-metadata">

**Author:** [@maxgotts](https://discourse.mc-stan.org/u/maxgotts)\
**Replies:** 9\
**Last updated:** [September 29, 2025, 5:02am UTC](https://discourse.mc-stan.org/t/consistent-errors-bias-in-retrodiction-parameter-recovery-of-a-single-parameter-in-a-multilevel-gamma-model/34711 "2025-09-29T05:02:14Z")

</div>

The Short Story I have written a multilevel model that includes normal and gamma distributions, and it does really well at retrodicting (i.e. recovering) the “true” parameters from simulated data. However, for one param…

---

## [Projpred: Fixing Group Effects in Search Terms and Tips for Speed?](https://discourse.mc-stan.org/t/projpred-fixing-group-effects-in-search-terms-and-tips-for-speed/31678)

<div class="topic-metadata">

**Author:** [@l-gorman](https://discourse.mc-stan.org/u/l-gorman)\
**Replies:** 7\
**Last updated:** [September 3, 2025, 10:16am UTC](https://discourse.mc-stan.org/t/projpred-fixing-group-effects-in-search-terms-and-tips-for-speed/31678 "2025-09-03T10:16:08Z")

</div>

Firstly, thanks so much for all of the work on BRMS, STAN, and projpred, these are all fantastic tools!!! And apologies in advance if my question is daft, I am still learning about these tools and I have likely overlooke…

---

## [Trouble converting JAGS IRT model to Stan](https://discourse.mc-stan.org/t/trouble-converting-jags-irt-model-to-stan/39984)

<div class="topic-metadata">

**Author:** [@William\_Bradley](https://discourse.mc-stan.org/u/William_Bradley)\
**Replies:** 3\
**Last updated:** [July 28, 2025, 2:11pm UTC](https://discourse.mc-stan.org/t/trouble-converting-jags-irt-model-to-stan/39984 "2025-07-28T14:11:31Z")

</div>

I am replicating the model introduced in this paper, which uses item-response theory to indirectly estimate support for militant groups in Pakistan by a so-called endorsement experiment. Specifically, I am following the …

---

## [Half-normal in brms](https://discourse.mc-stan.org/t/half-normal-in-brms/39744)

<div class="topic-metadata">

**Author:** [@lldb14](https://discourse.mc-stan.org/u/lldb14)\
**Replies:** 10\
**Last updated:** [June 26, 2025, 1:04pm UTC](https://discourse.mc-stan.org/t/half-normal-in-brms/39744 "2025-06-26T13:04:10Z")

</div>

sorry if this is a stupid question, but how do I specify a response half-normal in brms, i tried to do it like this but I get an error bf(LDM ~ -1 +harvest + (1 | gr(genotype, id = “genotype”)) + (1 | gr(block, id = “b…

---

## [Modeling logistic regression with variable number of predictors](https://discourse.mc-stan.org/t/modeling-logistic-regression-with-variable-number-of-predictors/39689)

<div class="topic-metadata">

**Author:** [@RDMelamed](https://discourse.mc-stan.org/u/RDMelamed)\
**Replies:** 9\
**Last updated:** [June 23, 2025, 6:18pm UTC](https://discourse.mc-stan.org/t/modeling-logistic-regression-with-variable-number-of-predictors/39689 "2025-06-23T18:18:05Z")

</div>

I’m trying to do something similar to a hierarchical logistic regression. For each binary label, I have a variable number of continuous predictors. Ideally, I’d also be able to make predictions for held out labels using …

---

## [Understanding group-level correlations](https://discourse.mc-stan.org/t/understanding-group-level-correlations/39748)

<div class="topic-metadata">

**Author:** [@amynang](https://discourse.mc-stan.org/u/amynang)\
**Replies:** 3\
**Last updated:** [June 20, 2025, 9:54pm UTC](https://discourse.mc-stan.org/t/understanding-group-level-correlations/39748 "2025-06-20T21:54:15Z")

</div>

I am trying to fit a multivariate nonlinear model that describes the reaction norms of phytoplankton gross photosynthesis and respiration rates to temperature. The data are rate measurements at different temperatures for…

---

## [Help with Bayesian Model Comparison for Hierarchical Models](https://discourse.mc-stan.org/t/help-with-bayesian-model-comparison-for-hierarchical-models/39562)

<div class="topic-metadata">

**Author:** [@als\_che](https://discourse.mc-stan.org/u/als_che)\
**Replies:** 2\
**Last updated:** [June 10, 2025, 9:41am UTC](https://discourse.mc-stan.org/t/help-with-bayesian-model-comparison-for-hierarchical-models/39562 "2025-06-10T09:41:41Z")

</div>

Hi everyone, I’m struggling to compute meaningful Bayes Factors or model comparison metrics for a hierarchical model, possibly because my background is more frequentist. Here’s my problem: I have repeated measurements…

---

## [\[Publication\] Computational characterization of metacognitive ability in subjective decision-making](https://discourse.mc-stan.org/t/publication-computational-characterization-of-metacognitive-ability-in-subjective-decision-making/39596)

<div class="topic-metadata">

**Author:** [@Corey.Plate](https://discourse.mc-stan.org/u/Corey.Plate)\
**Replies:** 2\
**Last updated:** [June 4, 2025, 10:50pm UTC](https://discourse.mc-stan.org/t/publication-computational-characterization-of-metacognitive-ability-in-subjective-decision-making/39596 "2025-06-04T22:50:07Z")

</div>

Hello all, I am very excited to announce our bioRxiv preprint, “Computational characterization of metacognitive ability in subjective decision-making”! You can find the publication here: https://www.biorxiv.org/content…

---

## [Measurement error model with coefficient of variation](https://discourse.mc-stan.org/t/measurement-error-model-with-coefficient-of-variation/39634)

<div class="topic-metadata">

**Author:** [@lukaseamus](https://discourse.mc-stan.org/u/lukaseamus)\
**Replies:** 2\
**Last updated:** [June 3, 2025, 11:13pm UTC](https://discourse.mc-stan.org/t/measurement-error-model-with-coefficient-of-variation/39634 "2025-06-03T23:13:26Z")

</div>

So far I have always modelled measurement error according to the guide and McElreath because I usually have a mean and standard deviation (s.d.). I have recently come across a case where I have an observed average (y\_obs)…

---

## [Proper use of sum\_to\_zero\_vector in nested multilevel models](https://discourse.mc-stan.org/t/proper-use-of-sum-to-zero-vector-in-nested-multilevel-models/39536)

<div class="topic-metadata">

**Author:** [@lukaseamus](https://discourse.mc-stan.org/u/lukaseamus)\
**Replies:** 17\
**Last updated:** [June 2, 2025, 2:22pm UTC](https://discourse.mc-stan.org/t/proper-use-of-sum-to-zero-vector-in-nested-multilevel-models/39536 "2025-06-02T14:22:54Z")

</div>

In nested multilevel models we model variability between experimental units within rather than across groups of interest, hence nested. In the simplest case one group is known a priori to have much lower variability betw…

---

## [Open data and brms code for causal spatial agricultural problem](https://discourse.mc-stan.org/t/open-data-and-brms-code-for-causal-spatial-agricultural-problem/39555)

<div class="topic-metadata">

**Author:** [@potash](https://discourse.mc-stan.org/u/potash)\
**Replies:** 2\
**Last updated:** [May 31, 2025, 2:51pm UTC](https://discourse.mc-stan.org/t/open-data-and-brms-code-for-causal-spatial-agricultural-problem/39555 "2025-05-31T14:51:05Z")

</div>

I recently published a short note that uses a multilevel model with a GP component for causal inference and thought that it may be of interest to some of you. The data comes from the Morrow Plots. This is the second old…

---

## [Does this hierarchical brms formula correctly link covariates across the multiple nested levels?](https://discourse.mc-stan.org/t/does-this-hierarchical-brms-formula-correctly-link-covariates-across-the-multiple-nested-levels/32410)

<div class="topic-metadata">

**Author:** [@andrewheiss](https://discourse.mc-stan.org/u/andrewheiss)\
**Replies:** 4\
**Last updated:** [May 30, 2025, 1:10am UTC](https://discourse.mc-stan.org/t/does-this-hierarchical-brms-formula-correctly-link-covariates-across-the-multiple-nested-levels/32410 "2025-05-30T01:10:11Z")

</div>

This may be a naively obvious question, but I figured I’d ask. Is there a way to use {brms} to fit a multilevel/hierarchical model with substantial numbers of predictors at different levels in the model? (e.g. if modeli…

---

## [Constraining the cluster probabilities in mixture models](https://discourse.mc-stan.org/t/constraining-the-cluster-probabilities-in-mixture-models/39515)

<div class="topic-metadata">

**Author:** [@lorenzo\_cappiello](https://discourse.mc-stan.org/u/lorenzo_cappiello)\
**Replies:** 7\
**Last updated:** [May 27, 2025, 10:23pm UTC](https://discourse.mc-stan.org/t/constraining-the-cluster-probabilities-in-mixture-models/39515 "2025-05-27T22:23:43Z")

</div>

Hi Everyone, I have developed a hierarchical Beta bivariate mixture model with gaussian copula. And I need it to constrain it so that the only possible values are in between .01, and .99. However, it does not work. Can …

---

## [Identifying "significant" interaction effect in multi-individual, multi-species, multi-treatment model?](https://discourse.mc-stan.org/t/identifying-significant-interaction-effect-in-multi-individual-multi-species-multi-treatment-model/39565)

<div class="topic-metadata">

**Author:** [@pollardmd](https://discourse.mc-stan.org/u/pollardmd)\
**Replies:** 2\
**Last updated:** [May 22, 2025, 7:51pm UTC](https://discourse.mc-stan.org/t/identifying-significant-interaction-effect-in-multi-individual-multi-species-multi-treatment-model/39565 "2025-05-22T19:51:52Z")

</div>

Hi all, I have a data set consisting of several thousand reactions. For each reaction, there is a response variable (continuous between 0 and 1) that has been measured in 5 individuals per species, 12 species in total, …

---

## [Non-centered parameterization with boundaries for multiple coefficients](https://discourse.mc-stan.org/t/non-centered-parameterization-with-boundaries-for-multiple-coefficients/26701)

<div class="topic-metadata">

**Author:** [@sonicking](https://discourse.mc-stan.org/u/sonicking)\
**Replies:** 3\
**Last updated:** [May 16, 2025, 7:46pm UTC](https://discourse.mc-stan.org/t/non-centered-parameterization-with-boundaries-for-multiple-coefficients/26701 "2025-05-16T19:46:20Z")

</div>

Hi, I would like to know if it is possible to declare bounded random effects with non-centered parameterization for multiple coefficients. I read a very elegant solution here. This is great for one coefficient. I am …

---

## [Slow running hierachical model](https://discourse.mc-stan.org/t/slow-running-hierachical-model/39461)

<div class="topic-metadata">

**Author:** [@niels\_aak](https://discourse.mc-stan.org/u/niels_aak)\
**Replies:** 0\
**Last updated:** [May 10, 2025, 1:08pm UTC](https://discourse.mc-stan.org/t/slow-running-hierachical-model/39461 "2025-05-10T13:08:55Z")

</div>

Hi everyone I have a hierarchical model specified in the following way. It does okay in fitting on low amounts of data, but when I scale it it takes a very long time to fit. I need to be able to fit 300,000 observations…

---

## [Linear no-intercept model in brms interpretation](https://discourse.mc-stan.org/t/linear-no-intercept-model-in-brms-interpretation/39290)

<div class="topic-metadata">

**Author:** [@fritz](https://discourse.mc-stan.org/u/fritz)\
**Replies:** 4\
**Last updated:** [April 27, 2025, 10:29pm UTC](https://discourse.mc-stan.org/t/linear-no-intercept-model-in-brms-interpretation/39290 "2025-04-27T22:29:10Z")

</div>

Hi everyone. I’m new to stan and bayesian stats and have a rather stupid question about understanding the model definition in brms non-linear specification. I’m trying to gage the influence of different predictors on a …

---

## [Divergent transitions in linear hiearchical model with null data](https://discourse.mc-stan.org/t/divergent-transitions-in-linear-hiearchical-model-with-null-data/39286)

<div class="topic-metadata">

**Author:** [@benkay86](https://discourse.mc-stan.org/u/benkay86)\
**Replies:** 3\
**Last updated:** [April 16, 2025, 9:38pm UTC](https://discourse.mc-stan.org/t/divergent-transitions-in-linear-hiearchical-model-with-null-data/39286 "2025-04-16T21:38:55Z")

</div>

I am having trouble getting the most basic of hierarchical linear models to work without divergent transitions, and I am hoping someone can get me un-stuck! I have data on around 1,000 individuals each with some feature…

---

## [Different dispersion hyperparameters for each unique level of a factor](https://discourse.mc-stan.org/t/different-dispersion-hyperparameters-for-each-unique-level-of-a-factor/39115)

<div class="topic-metadata">

**Author:** [@dmz](https://discourse.mc-stan.org/u/dmz)\
**Replies:** 3\
**Last updated:** [April 2, 2025, 8:37pm UTC](https://discourse.mc-stan.org/t/different-dispersion-hyperparameters-for-each-unique-level-of-a-factor/39115 "2025-04-02T20:37:51Z")

</div>

Please forgive my ignorance of the proper hierarchical regression nomenclature and conventions. I am sure that what I want is quite easily achieved, but I don’t know the right terms under which to search. I want to fit a…

---

## [Random intercept and slope model with constraints](https://discourse.mc-stan.org/t/random-intercept-and-slope-model-with-constraints/39024)

<div class="topic-metadata">

**Author:** [@jlm1973](https://discourse.mc-stan.org/u/jlm1973)\
**Replies:** 3\
**Last updated:** [March 12, 2025, 8:45pm UTC](https://discourse.mc-stan.org/t/random-intercept-and-slope-model-with-constraints/39024 "2025-03-12T20:45:14Z")

</div>

Hello, I am new to using Stan and would appreciate some help and advice with a model I am trying to fit. The data consists of a set of scores per individual at different ages. I want to fit a linear model where score is…

---

## [Lognormal Hierarchical Distribution Fitting](https://discourse.mc-stan.org/t/lognormal-hierarchical-distribution-fitting/14334)

<div class="topic-metadata">

**Author:** [@jwright11](https://discourse.mc-stan.org/u/jwright11)\
**Replies:** 10\
**Last updated:** [February 11, 2025, 10:34pm UTC](https://discourse.mc-stan.org/t/lognormal-hierarchical-distribution-fitting/14334 "2025-02-11T22:34:24Z")

</div>

Hi All, I’m just getting started with Stan and I’m having a little trouble. The thing I’m interested in doing is basically hierarchical distribution fitting of insurance claim amounts by state. I’ve simulated (from a lo…

[Next page](https://discourse.mc-stan.org/tag/hierarchical-model/112.md?match_all_tags=true&page=1&tags%5B%5D=hierarchical-model)
