# Modeling

**URL:** https://discourse.mc-stan.org/c/modeling/9.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 Modeling category](https://discourse.mc-stan.org/t/about-the-modeling-category/20)

<div class="topic-metadata">

**Author:** [@betanalpha](https://discourse.mc-stan.org/u/betanalpha)\
**Replies:** 1\
**Last updated:** [July 23, 2019, 8:12pm UTC](https://discourse.mc-stan.org/t/about-the-modeling-category/20 "2019-07-23T20:12:41Z")

</div>

This category is for issues with specifying models as Stan programs or fitting them in Stan. We highly recommend that you include the full model that you are trying to fit as well as any data (preferably in a text fi…

---

## [Modelling noise with temporal autocorrelation](https://discourse.mc-stan.org/t/modelling-noise-with-temporal-autocorrelation/41815)

<div class="topic-metadata">

**Author:** [@Edouard2laire](https://discourse.mc-stan.org/u/Edouard2laire)\
**Replies:** 4\
**Last updated:** [November 10, 2026, 9:35pm UTC](https://discourse.mc-stan.org/t/modelling-noise-with-temporal-autocorrelation/41815 "2026-11-10T21:35:10Z")

</div>

Hello, Background i am trying to reproduce this model Autoregressive model based algorithm for correcting motion and serially correlated errors in fNIRS - PMC in Stan. In short, we are using a GLM to model a time cour…

---

## [Log Student-t comparing differences in scale](https://discourse.mc-stan.org/t/log-student-t-comparing-differences-in-scale/41729)

<div class="topic-metadata">

**Author:** [@Hunter24](https://discourse.mc-stan.org/u/Hunter24)\
**Replies:** 2\
**Last updated:** [November 6, 2026, 6:41am UTC](https://discourse.mc-stan.org/t/log-student-t-comparing-differences-in-scale/41729 "2026-11-06T06:41:04Z")

</div>

I am doing a log student t distribution. All nu values are above 2 so both mean and variance exist. I want to compare the log sigmas between groups, so taking the difference in the posteriors of log sigma\_group1 - log s…

---

## [Sampling Prandtl–Ishlinskii hysteresis parameters in a small ODE model: most fits fail convergence checks](https://discourse.mc-stan.org/t/sampling-prandtl-ishlinskii-hysteresis-parameters-in-a-small-ode-model-most-fits-fail-convergence-checks/41689)

<div class="topic-metadata">

**Author:** [@Tanner\_Overby](https://discourse.mc-stan.org/u/Tanner_Overby)\
**Replies:** 2\
**Last updated:** [November 5, 2026, 7:57pm UTC](https://discourse.mc-stan.org/t/sampling-prandtl-ishlinskii-hysteresis-parameters-in-a-small-ode-model-most-fits-fail-convergence-checks/41689 "2026-11-05T19:57:54Z")

</div>

I’m fitting a small system-identification model: a mass–spring–damper m\\\\ddot x + c\\\\dot x + kx = H\\\[u\\\](t-d), observed with Gaussian noise \\\\sigma, where d \\\\in \\\\{0,1,2,3\\\\} is a discrete input delay. H is a Prandtl–Is…

---

## [A "squashed" normal distribution](https://discourse.mc-stan.org/t/a-squashed-normal-distribution/41655)

<div class="topic-metadata">

**Author:** [@maxgotts](https://discourse.mc-stan.org/u/maxgotts)\
**Replies:** 10\
**Last updated:** [November 2, 2026, 6:44am UTC](https://discourse.mc-stan.org/t/a-squashed-normal-distribution/41655 "2026-11-02T06:44:11Z")

</div>

I often find myself trying to fit a normal distribution that is skewed. Not a “skewed normal distribution,” but a normal distribution with one side cut to nearly zero. I’ve even gone as far as trying to make a custom log…

---

## [Using an R2D2-style prior for the ICC (brms/Stan)?](https://discourse.mc-stan.org/t/using-an-r2d2-style-prior-for-the-icc-brms-stan/41686)

<div class="topic-metadata">

**Author:** [@rbcavanaugh](https://discourse.mc-stan.org/u/rbcavanaugh)\
**Replies:** 6\
**Last updated:** [October 30, 2026, 1:41pm UTC](https://discourse.mc-stan.org/t/using-an-r2d2-style-prior-for-the-icc-brms-stan/41686 "2026-10-30T13:41:20Z")

</div>

In a frequentist framework, the ICC (the proportion of true-score variance) for test-retest or rater reliability comes can be estimated form a mixed model in lme4: fit y ~ 1 + (1 | subject) + (1 | rater) and take the sub…

---

## [Initialization failure in negative-binomial model with exact and right-censored likelihood contributions](https://discourse.mc-stan.org/t/initialization-failure-in-negative-binomial-model-with-exact-and-right-censored-likelihood-contributions/41644)

<div class="topic-metadata">

**Author:** [@arumadri](https://discourse.mc-stan.org/u/arumadri)\
**Replies:** 7\
**Last updated:** [October 28, 2026, 3:16pm UTC](https://discourse.mc-stan.org/t/initialization-failure-in-negative-binomial-model-with-exact-and-right-censored-likelihood-contributions/41644 "2026-10-28T15:16:55Z")

</div>

I’m trying to fit a large spatial-temporal Bayesian model with close to 1,700 areas across 10 years in Stan using a negative-binomial model with exact and right-censored likelihood contributions. Predictors include meter…

---

## [How do deal with non-plausible steady state in ODE](https://discourse.mc-stan.org/t/how-do-deal-with-non-plausible-steady-state-in-ode/41691)

<div class="topic-metadata">

**Author:** [@emil\_frej](https://discourse.mc-stan.org/u/emil_frej)\
**Replies:** 5\
**Last updated:** [October 27, 2026, 8:11pm UTC](https://discourse.mc-stan.org/t/how-do-deal-with-non-plausible-steady-state-in-ode/41691 "2026-10-27T20:11:33Z")

</div>

I’m working on a model of prostate cancer for which the data often pushes posteriors toward results that we are pretty confident are wrong. I’m hoping someone has input on what a principled way to deal with this situatio…

---

## [Equivalence between lkj\_corr\_lpdf(matrix L | eta = 1) and uniform prior on cholesky\_factor\_corr\[n\] L;](https://discourse.mc-stan.org/t/equivalence-between-lkj-corr-lpdf-matrix-l-eta-1-and-uniform-prior-on-cholesky-factor-corr-n-l/41660)

<div class="topic-metadata">

**Author:** [@PaulVBell](https://discourse.mc-stan.org/u/PaulVBell)\
**Replies:** 10\
**Last updated:** [October 20, 2026, 7:43pm UTC](https://discourse.mc-stan.org/t/equivalence-between-lkj-corr-lpdf-matrix-l-eta-1-and-uniform-prior-on-cholesky-factor-corr-n-l/41660 "2026-10-20T19:43:34Z")

</div>

Hi folks, I have a quick question regarding the LKJ prior. When using \\eta = 1 is: parameters { cholesky\_factor\_corr\[n\] L; } model { target+= lkj\_corr\_lpdf(L | eta = 1); } Equivalent to no prior on L: parame…

---

## [How to handle divergent chains in Stan mixture models](https://discourse.mc-stan.org/t/how-to-handle-divergent-chains-in-stan-mixture-models/41598)

<div class="topic-metadata">

**Author:** [@digikar](https://discourse.mc-stan.org/u/digikar)\
**Replies:** 5\
**Last updated:** [October 12, 2026, 7:20pm UTC](https://discourse.mc-stan.org/t/how-to-handle-divergent-chains-in-stan-mixture-models/41598 "2026-10-12T19:20:05Z")

</div>

Hello, I want to use a mixture model to decide whether my data is better explained by two components or by a single component. For example, let me take (simulated) data to be the following. The model behaves well (Reff …

---

## [How to choose a prior for the count parameter](https://discourse.mc-stan.org/t/how-to-choose-a-prior-for-the-count-parameter/41653)

<div class="topic-metadata">

**Author:** [@yanmin](https://discourse.mc-stan.org/u/yanmin)\
**Replies:** 2\
**Last updated:** [October 12, 2026, 7:19am UTC](https://discourse.mc-stan.org/t/how-to-choose-a-prior-for-the-count-parameter/41653 "2026-10-12T07:19:38Z")

</div>

In the case of the Beta, the obvious choice for reparameterization is in terms of a mean parameter \\phi = \\alpha /(\\alpha + \\beta) and total count parameter \\lambda = \\alpha + \\beta in the Stan user guide, the coun…

---

## [Models of benchmark performance for software refactoring?](https://discourse.mc-stan.org/t/models-of-benchmark-performance-for-software-refactoring/41636)

<div class="topic-metadata">

**Author:** [@Bob\_Carpenter](https://discourse.mc-stan.org/u/Bob_Carpenter)\
**Replies:** 9\
**Last updated:** [October 8, 2026, 1:30am UTC](https://discourse.mc-stan.org/t/models-of-benchmark-performance-for-software-refactoring/41636 "2026-10-08T01:30:07Z")

</div>

I’m writing to ask if people have recommendations for models of profiling/benchmarking. The data I have at hand is 25K paired observations of new code vs. old code timing (or old code vs. old code for a control). Ther…

---

## [Province-Level Clustered Standard Errors in MRP](https://discourse.mc-stan.org/t/province-level-clustered-standard-errors-in-mrp/41610)

<div class="topic-metadata">

**Author:** [@yanmin](https://discourse.mc-stan.org/u/yanmin)\
**Replies:** 4\
**Last updated:** [September 28, 2026, 5:14pm UTC](https://discourse.mc-stan.org/t/province-level-clustered-standard-errors-in-mrp/41610 "2026-09-28T17:14:10Z")

</div>

I conducted a study using Multilevel Regression and Poststratification (MRP). One reviewer raised the following concern: “Following Abadie et al. (2023), if the authors insist on conducting the analysis at the province …

---

## [Dependence between binary responses in multivariate brms](https://discourse.mc-stan.org/t/dependence-between-binary-responses-in-multivariate-brms/41608)

<div class="topic-metadata">

**Author:** [@JKingston](https://discourse.mc-stan.org/u/JKingston)\
**Replies:** 5\
**Last updated:** [September 20, 2026, 8:49pm UTC](https://discourse.mc-stan.org/t/dependence-between-binary-responses-in-multivariate-brms/41608 "2026-09-20T20:49:11Z")

</div>

I have data in which participants chose between 4 possible responses on each trial. The 4 responses are best understood, however, as two binary choices, i.e., “w” vs “b” and “2” vs “1”. What I want to get from the model …

---

## [On LOO CV for non-factorizable normal models](https://discourse.mc-stan.org/t/on-loo-cv-for-non-factorizable-normal-models/7336)

<div class="topic-metadata">

**Author:** [@Elizaveta\_Semenova](https://discourse.mc-stan.org/u/Elizaveta_Semenova)\
**Replies:** 2\
**Last updated:** [September 17, 2026, 8:39pm UTC](https://discourse.mc-stan.org/t/on-loo-cv-for-non-factorizable-normal-models/7336 "2026-09-17T20:39:45Z")

</div>

Dear all, I have a question concerning LOO-CV for non-factorisable normal models, developed in the paper “Leave-one-out cross-validation for non-factorizable normal models” by Bürkner, Gabry, Vehtari. The idea of the pa…

---

## [Can some individual-level predictors included in the regression model be excluded from the poststratification frame?](https://discourse.mc-stan.org/t/can-some-individual-level-predictors-included-in-the-regression-model-be-excluded-from-the-poststratification-frame/41592)

<div class="topic-metadata">

**Author:** [@yanmin](https://discourse.mc-stan.org/u/yanmin)\
**Replies:** 2\
**Last updated:** [September 17, 2026, 1:37am UTC](https://discourse.mc-stan.org/t/can-some-individual-level-predictors-included-in-the-regression-model-be-excluded-from-the-poststratification-frame/41592 "2026-09-17T01:37:05Z")

</div>

In multilevel regression and poststratification (MRP), do all individual-level predictors included in the regression model need to be available in the poststratification frame? For example, if the poststratification fram…

---

## [Sum-to-zero with a covariance matrix](https://discourse.mc-stan.org/t/sum-to-zero-with-a-covariance-matrix/41558)

<div class="topic-metadata">

**Author:** [@mhollanders](https://discourse.mc-stan.org/u/mhollanders)\
**Replies:** 8\
**Last updated:** [September 15, 2026, 9:52pm UTC](https://discourse.mc-stan.org/t/sum-to-zero-with-a-covariance-matrix/41558 "2026-09-15T21:52:22Z")

</div>

Hi all, Given the surge of posts about sum-to-zero recently I thought I’d add another one. I’ve posted about this on Slack before but it might be of broader interest. My question is about implementing sum-to-zero vecto…

---

## [Keep getting infinite gradient although likelihood is differentiable](https://discourse.mc-stan.org/t/keep-getting-infinite-gradient-although-likelihood-is-differentiable/41541)

<div class="topic-metadata">

**Author:** [@SeHellmann](https://discourse.mc-stan.org/u/SeHellmann)\
**Replies:** 8\
**Last updated:** [September 8, 2026, 8:28pm UTC](https://discourse.mc-stan.org/t/keep-getting-infinite-gradient-although-likelihood-is-differentiable/41541 "2026-09-08T20:28:57Z")

</div>

I am trying to fit a model to a couple (19) datasets. For 16 datasets, the model runs smoothly (no divergences, reasonable Rhat, and very good ESSs). But it seems, three datasets are a bit hard to estimate. I determined …

---

## [How to specify non centered parameterization for sigma in a distributional model in brms](https://discourse.mc-stan.org/t/how-to-specify-non-centered-parameterization-for-sigma-in-a-distributional-model-in-brms/41570)

<div class="topic-metadata">

**Author:** [@rstanuser](https://discourse.mc-stan.org/u/rstanuser)\
**Replies:** 8\
**Last updated:** [September 7, 2026, 11:13pm UTC](https://discourse.mc-stan.org/t/how-to-specify-non-centered-parameterization-for-sigma-in-a-distributional-model-in-brms/41570 "2026-09-07T23:13:28Z")

</div>

I want to fit a distributional model with brms along the following lines: df \<- data.frame() # some columns include: # value (continuous, zero-mean), # afactor (3 levels), bfactor (7 levels), # gfactor (240 level…

---

## [Discretizing a hurdle model in order to compare it to a gaussian model: Part 2](https://discourse.mc-stan.org/t/discretizing-a-hurdle-model-in-order-to-compare-it-to-a-gaussian-model-part-2/41562)

<div class="topic-metadata">

**Author:** [@llewmills](https://discourse.mc-stan.org/u/llewmills)\
**Replies:** 4\
**Last updated:** [September 7, 2026, 9:31pm UTC](https://discourse.mc-stan.org/t/discretizing-a-hurdle-model-in-order-to-compare-it-to-a-gaussian-model-part-2/41562 "2026-09-07T21:31:40Z")

</div>

In this post a few days ago I attempted to get some advice on the procedure for discretizing a hurdle model and a gaussian model of the same outcome data so as to compare the two (recommended by @avehtari in his reply he…

---

## [LOO with brms::add\_criterion crashes the R session](https://discourse.mc-stan.org/t/loo-with-brms-add-criterion-crashes-the-r-session/41554)

<div class="topic-metadata">

**Author:** [@Anoban](https://discourse.mc-stan.org/u/Anoban)\
**Replies:** 5\
**Last updated:** [September 2, 2026, 1:22pm UTC](https://discourse.mc-stan.org/t/loo-with-brms-add-criterion-crashes-the-r-session/41554 "2026-09-02T13:22:47Z")

</div>

Hi folks, I’m trying to compare 8 brms models (6 as of now, still waiting for two to finish) using loo with moment\_match = TRUE but keep constantly running into crashes where the OS kills the R process. These models are…

---

## [Comparing loo of discretised versions of hurdle lognormal and normal models](https://discourse.mc-stan.org/t/comparing-loo-of-discretised-versions-of-hurdle-lognormal-and-normal-models/41559)

<div class="topic-metadata">

**Author:** [@llewmills](https://discourse.mc-stan.org/u/llewmills)\
**Replies:** 5\
**Last updated:** [August 31, 2026, 11:04pm UTC](https://discourse.mc-stan.org/t/comparing-loo-of-discretised-versions-of-hurdle-lognormal-and-normal-models/41559 "2026-08-31T23:04:39Z")

</div>

I am trying to evaluate the relative performance of a hurdle lognormal model against a standard linear/gaussian model, conducted on the same data, a right-skewed integer 0-100 scale with a lot of 0’s and a normal-ish dis…

---

## [Comparing a hurdle lognormal model to a gaussian model with loo-cv](https://discourse.mc-stan.org/t/comparing-a-hurdle-lognormal-model-to-a-gaussian-model-with-loo-cv/41532)

<div class="topic-metadata">

**Author:** [@llewmills](https://discourse.mc-stan.org/u/llewmills)\
**Replies:** 2\
**Last updated:** [August 26, 2026, 10:23am UTC](https://discourse.mc-stan.org/t/comparing-a-hurdle-lognormal-model-to-a-gaussian-model-with-loo-cv/41532 "2026-08-26T10:23:37Z")

</div>

I have been posting a lot lately about comparing models with different link functions fit to the same data (see here and here). This post is an extension of those. I am simply wondering if I can compare a hurdle lognorm…

---

## [Student\_t](https://discourse.mc-stan.org/t/student-t/41526)

<div class="topic-metadata">

**Author:** [@Hunter24](https://discourse.mc-stan.org/u/Hunter24)\
**Replies:** 5\
**Last updated:** [August 22, 2026, 12:49pm UTC](https://discourse.mc-stan.org/t/student-t/41526 "2026-08-22T12:49:00Z")

</div>

When fitting a Student-t model, how should the posterior distribution of the degrees-of-freedom parameter (ν) affect interpretation of the mean and variance? If most of the posterior for ν is above 2, but some probabilit…

---

## [Correlated posterior - Sum to zero constraint for varying intercepts?!](https://discourse.mc-stan.org/t/correlated-posterior-sum-to-zero-constraint-for-varying-intercepts/25608)

<div class="topic-metadata">

**Author:** [@martinmodrak](https://discourse.mc-stan.org/u/martinmodrak)\
**Replies:** 21\
**Last updated:** [August 22, 2026, 4:55am UTC](https://discourse.mc-stan.org/t/correlated-posterior-sum-to-zero-constraint-for-varying-intercepts/25608 "2026-08-22T04:55:54Z")

</div>

Hi, so here’s an issue I’ve ran into in a couple analyses where simple uses of varying (random) intercepts resulted in problematic posterior distributions. In particular, the posterior for the overall intercept is negat…

---

## [Multiresponse brms models - chains finishing unexpectedly](https://discourse.mc-stan.org/t/multiresponse-brms-models-chains-finishing-unexpectedly/41534)

<div class="topic-metadata">

**Author:** [@Anoban](https://discourse.mc-stan.org/u/Anoban)\
**Replies:** 2\
**Last updated:** [August 21, 2026, 1:58am UTC](https://discourse.mc-stan.org/t/multiresponse-brms-models-chains-finishing-unexpectedly/41534 "2026-08-21T01:58:35Z")

</div>

Hi there! (I was redirected from github here). I’m running a set of phylogenetic and non-phylogenetic brms models on a Ubuntu 24.04.4 server with brms version 2.23.0, cmdstanr version 0.9.0 and R version 4.6.1, using cm…

---

## [Complex indexing for missing covariates](https://discourse.mc-stan.org/t/complex-indexing-for-missing-covariates/41527)

<div class="topic-metadata">

**Author:** [@nelsjohnson](https://discourse.mc-stan.org/u/nelsjohnson)\
**Replies:** 1\
**Last updated:** [August 19, 2026, 4:01pm UTC](https://discourse.mc-stan.org/t/complex-indexing-for-missing-covariates/41527 "2026-08-19T16:01:41Z")

</div>

I think this is a common enough question, but I am still having issues with it. I have a matrix of covariates \\mathbf{X} (no intercept) where some some observations i=1,2,\\ldots,N (rows) are missing for some covariates j…

---

## [Divergent transitions fitting smooths in brms](https://discourse.mc-stan.org/t/divergent-transitions-fitting-smooths-in-brms/41517)

<div class="topic-metadata">

**Author:** [@PaulVBell](https://discourse.mc-stan.org/u/PaulVBell)\
**Replies:** 6\
**Last updated:** [August 18, 2026, 8:48am UTC](https://discourse.mc-stan.org/t/divergent-transitions-fitting-smooths-in-brms/41517 "2026-08-18T08:48:47Z")

</div>

I’m trying to get my head around using smoothing splines with brms. I generated a simple dataset (sin wave plus normal noise): And fit the following brms model, for B-splines with 10 knots: fit\_brms \<- brm( y ~ s…

---

## [Estimating flood hazard curves with a hierarchical log-increment model](https://discourse.mc-stan.org/t/estimating-flood-hazard-curves-with-a-hierarchical-log-increment-model/41469)

<div class="topic-metadata">

**Author:** [@jackelsey](https://discourse.mc-stan.org/u/jackelsey)\
**Replies:** 7\
**Last updated:** [August 17, 2026, 12:34pm UTC](https://discourse.mc-stan.org/t/estimating-flood-hazard-curves-with-a-hierarchical-log-increment-model/41469 "2026-08-17T12:34:19Z")

</div>

I’m working for a US government program that is developing a new process for generating maps of flooding hazards. I’d appreciate feedback on the Bayesian formulation below, particularly its separation of aleatoric and ep…

---

## [Ppc\_loo\_pit\_overlay](https://discourse.mc-stan.org/t/ppc-loo-pit-overlay/41501)

<div class="topic-metadata">

**Author:** [@Hunter24](https://discourse.mc-stan.org/u/Hunter24)\
**Replies:** 5\
**Last updated:** [August 13, 2026, 2:13pm UTC](https://discourse.mc-stan.org/t/ppc-loo-pit-overlay/41501 "2026-08-13T14:13:39Z")

</div>

I am try to see if my model is valid. I ran a beta glmm in brms. brm.formula.1 \<- bf( prop ~ 0 + group + # Group-specific independent random intercepts and slopes (1 | gr(ID, by = group)) + # OU correlat…

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