# \#fitting-issues

**URL:** https://discourse.mc-stan.org/tag/fitting-issues/16.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)

---

## [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:** 6\
**Last updated:** [October 12, 2026, 7:30pm UTC](https://discourse.mc-stan.org/t/a-squashed-normal-distribution/41655 "2026-10-12T19:30:29Z")

</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…

---

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

---

## [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:** 3\
**Last updated:** [October 10, 2026, 5:49pm UTC](https://discourse.mc-stan.org/t/initialization-failure-in-negative-binomial-model-with-exact-and-right-censored-likelihood-contributions/41644 "2026-10-10T17:49:57Z")

</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…

---

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

---

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

---

## [Random walk with positive differences and missing data](https://discourse.mc-stan.org/t/random-walk-with-positive-differences-and-missing-data/41470)

<div class="topic-metadata">

**Author:** [@lqsullivan](https://discourse.mc-stan.org/u/lqsullivan)\
**Replies:** 6\
**Last updated:** [August 12, 2026, 6:09pm UTC](https://discourse.mc-stan.org/t/random-walk-with-positive-differences-and-missing-data/41470 "2026-08-12T18:09:35Z")

</div>

I’m trying to modify a random walk model with exponential errors and missing observations to have differences that are also constrained to be positive. I’m struggling with the model because there’s something that feels c…

---

## [Difficulty adding loo criterion to longitudinal truncated normal model](https://discourse.mc-stan.org/t/difficulty-adding-loo-criterion-to-longitudinal-truncated-normal-model/41447)

<div class="topic-metadata">

**Author:** [@llewmills](https://discourse.mc-stan.org/u/llewmills)\
**Replies:** 14\
**Last updated:** [July 24, 2026, 8:44am UTC](https://discourse.mc-stan.org/t/difficulty-adding-loo-criterion-to-longitudinal-truncated-normal-model/41447 "2026-07-24T08:44:14Z")

</div>

I am analysing data from a clinical trial comparing placebo to active medication at multiple timepoint. One of my outcomes has a pronounced right-skew. The overwhelming majority of observations are between 0 and 0.03 but…

---

## [Trouble fitting random walk plus exponential error](https://discourse.mc-stan.org/t/trouble-fitting-random-walk-plus-exponential-error/41443)

<div class="topic-metadata">

**Author:** [@lqsullivan](https://discourse.mc-stan.org/u/lqsullivan)\
**Replies:** 2\
**Last updated:** [July 19, 2026, 2:34am UTC](https://discourse.mc-stan.org/t/trouble-fitting-random-walk-plus-exponential-error/41443 "2026-07-19T02:34:38Z")

</div>

I’m having trouble fitting a normal random walk with exponential errors, even on simulated data. I think (hope) I’m misunderstanding something about how to parameterize this so Stan likes it. The motivation is, there’s …

---

## [LKJ prior throwing positivity exceptions](https://discourse.mc-stan.org/t/lkj-prior-throwing-positivity-exceptions/41421)

<div class="topic-metadata">

**Author:** [@kyle.hofmann](https://discourse.mc-stan.org/u/kyle.hofmann)\
**Replies:** 10\
**Last updated:** [July 14, 2026, 7:00pm UTC](https://discourse.mc-stan.org/t/lkj-prior-throwing-positivity-exceptions/41421 "2026-07-14T19:00:14Z")

</div>

I am trying to use an LKJ prior. I have simplified my model down to the following. It’s so simple that I feel like I must be doing something wrong, yet it does not work for me: parameters { cholesky\_factor\_corr\[2\] L; …

---

## [Debugging a "stuck" sampler on a complex-ish model](https://discourse.mc-stan.org/t/debugging-a-stuck-sampler-on-a-complex-ish-model/41398)

<div class="topic-metadata">

**Author:** [@hjhornbeck](https://discourse.mc-stan.org/u/hjhornbeck)\
**Replies:** 9\
**Last updated:** [July 14, 2026, 4:50pm UTC](https://discourse.mc-stan.org/t/debugging-a-stuck-sampler-on-a-complex-ish-model/41398 "2026-07-14T16:50:54Z")

</div>

I’m currently having some issues with Stan’s NUTS sampler. I’ve encountered them before, but last time I think I fixed the issue by either hardening the model against outputting NaNs or “fixed” it by fiddling with random…

---

## [How can I deal with this heteroskedastic model?](https://discourse.mc-stan.org/t/how-can-i-deal-with-this-heteroskedastic-model/41432)

<div class="topic-metadata">

**Author:** [@Leonardo](https://discourse.mc-stan.org/u/Leonardo)\
**Replies:** 1\
**Last updated:** [July 8, 2026, 10:08pm UTC](https://discourse.mc-stan.org/t/how-can-i-deal-with-this-heteroskedastic-model/41432 "2026-07-08T22:08:08Z")

</div>

Hi all. I am interested in the latency it takes to flies to get attacked by predators, and the relationship between such latency and several covariates. I tested each spider more than once, so spider ID is a random fact…

---

## [Informative Priors and Fitting Issues in Meta-Analysis Regression with Missing Covariates](https://discourse.mc-stan.org/t/informative-priors-and-fitting-issues-in-meta-analysis-regression-with-missing-covariates/41388)

<div class="topic-metadata">

**Author:** [@Stream\_On](https://discourse.mc-stan.org/u/Stream_On)\
**Replies:** 1\
**Last updated:** [June 25, 2026, 4:43pm UTC](https://discourse.mc-stan.org/t/informative-priors-and-fitting-issues-in-meta-analysis-regression-with-missing-covariates/41388 "2026-06-25T16:43:13Z")

</div>

Hi Stan Community, I am currently experiencing convergence and fitting issues with a hierarchical Bayesian meta-analysis model implemented in Stan. Context & Data Layer The goal of the model is to estimate effect size…

---

## [Copula regression example (gaussian & poisson)](https://discourse.mc-stan.org/t/copula-regression-example-gaussian-poisson/35071)

<div class="topic-metadata">

**Author:** [@Greg94](https://discourse.mc-stan.org/u/Greg94)\
**Replies:** 20\
**Last updated:** [April 13, 2026, 9:48am UTC](https://discourse.mc-stan.org/t/copula-regression-example-gaussian-poisson/35071 "2026-04-13T09:48:32Z")

</div>

Hi This is a question about copulas in Stan. I am trying to estimate a copula model which introduces some correlation between a Gaussian and a Poisson regression. This is my data generating process: library(MASS) s\_siz…

---

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

---

## [Gaussian Process with measurement uncertainty and a large number of observations](https://discourse.mc-stan.org/t/gaussian-process-with-measurement-uncertainty-and-a-large-number-of-observations/40949)

<div class="topic-metadata">

**Author:** [@roberto\_r](https://discourse.mc-stan.org/u/roberto_r)\
**Replies:** 15\
**Last updated:** [March 16, 2026, 10:13am UTC](https://discourse.mc-stan.org/t/gaussian-process-with-measurement-uncertainty-and-a-large-number-of-observations/40949 "2026-03-16T10:13:07Z")

</div>

Hello all, I am trying to fit a GP model where I cannot observe time directly but I know the event happened at some point between a start date and an end date. At this stage there is no way to know the duration of the e…

---

## [Question: Diagnostic status used in both interaction and derived predictor — better to use split models?](https://discourse.mc-stan.org/t/question-diagnostic-status-used-in-both-interaction-and-derived-predictor-better-to-use-split-models/39831)

<div class="topic-metadata">

**Author:** [@Felix\_Requena](https://discourse.mc-stan.org/u/Felix_Requena)\
**Replies:** 2\
**Last updated:** [February 22, 2026, 12:34am UTC](https://discourse.mc-stan.org/t/question-diagnostic-status-used-in-both-interaction-and-derived-predictor-better-to-use-split-models/39831 "2026-02-22T00:34:46Z")

</div>

Hi all, I’m working on a brms model analyzing social behavior (Gregariousness, binary outcome) in a population of reptiles. Two key predictors of interest are: Disease status of the focal individual (Diagnostic: Healt…

---

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

---

## [Estimate time to run HMC](https://discourse.mc-stan.org/t/estimate-time-to-run-hmc/40933)

<div class="topic-metadata">

**Author:** [@bduque10](https://discourse.mc-stan.org/u/bduque10)\
**Replies:** 5\
**Last updated:** [February 19, 2026, 4:45am UTC](https://discourse.mc-stan.org/t/estimate-time-to-run-hmc/40933 "2026-02-19T04:45:29Z")

</div>

Hi. I have a computationally expensive individual-level model (~330 parameters, ~134K observations) where one of the computation chunks takes ~93% of the time. I’m using CmdStanR. Meanfield VI fits in about 30 minutes w…

---

## [Model convergence issue](https://discourse.mc-stan.org/t/model-convergence-issue/40901)

<div class="topic-metadata">

**Author:** [@Rahul](https://discourse.mc-stan.org/u/Rahul)\
**Replies:** 3\
**Last updated:** [February 17, 2026, 5:44pm UTC](https://discourse.mc-stan.org/t/model-convergence-issue/40901 "2026-02-17T17:44:28Z")

</div>

//Joint LC/RH model for fertility and surival data { int\<lower=1\> Nm; // number of mortality observation int\<lower=1\> Nf; // number of fertility observation int\<lower=1\> T; // years int\<lower=1\> Am; // ages for m…

---

## [Is there a way to accelerate this BetaBinomial and DirichletMultinomial model?](https://discourse.mc-stan.org/t/is-there-a-way-to-accelerate-this-betabinomial-and-dirichletmultinomial-model/40755)

<div class="topic-metadata">

**Author:** [@Amns](https://discourse.mc-stan.org/u/Amns)\
**Replies:** 3\
**Last updated:** [February 6, 2026, 8:59pm UTC](https://discourse.mc-stan.org/t/is-there-a-way-to-accelerate-this-betabinomial-and-dirichletmultinomial-model/40755 "2026-02-06T20:59:22Z")

</div>

I created the following .stan file called model\_tree. In essense it fits a BetaBinomial distribution when there are two categories, and a DirichletMultinomial when there are four categories. All the data that I provide a…

---

## ['cmath' file not found running brms models on Windows](https://discourse.mc-stan.org/t/cmath-file-not-found-running-brms-models-on-windows/40028)

<div class="topic-metadata">

**Author:** [@JulieHoward](https://discourse.mc-stan.org/u/JulieHoward)\
**Replies:** 1\
**Last updated:** [February 1, 2026, 5:21pm UTC](https://discourse.mc-stan.org/t/cmath-file-not-found-running-brms-models-on-windows/40028 "2026-02-01T17:21:03Z")

</div>

Short summary of the problem When I run this code: banova \<-brm(differenceinfavorabilityscore ~ group, anova2, prior=c(set\_prior("normal(0,2.06)", class= "b")), cores= 4) I get this error message: ## WARNING: Rtools …

---

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

---

## [Convergence problems (low E-BFMI, high Rhat and divergent transitions) for ordinal regression using a pR2D2M2ord prior](https://discourse.mc-stan.org/t/convergence-problems-low-e-bfmi-high-rhat-and-divergent-transitions-for-ordinal-regression-using-a-pr2d2m2ord-prior/40820)

<div class="topic-metadata">

**Author:** [@Xavier\_La\_Rochelle](https://discourse.mc-stan.org/u/Xavier_La_Rochelle)\
**Replies:** 4\
**Last updated:** [January 27, 2026, 6:33pm UTC](https://discourse.mc-stan.org/t/convergence-problems-low-e-bfmi-high-rhat-and-divergent-transitions-for-ordinal-regression-using-a-pr2d2m2ord-prior/40820 "2026-01-27T18:33:53Z")

</div>

Hi, I am running into convergence problems while fitting a model I have been working on for some time. I am getting the following diagnostics (with the data for context) : # Make data V1 data \<- list( N = nrow(df), #…

---

## [One regression equation with multiple error terms](https://discourse.mc-stan.org/t/one-regression-equation-with-multiple-error-terms/40867)

<div class="topic-metadata">

**Author:** [@Arne\_Henningsen](https://discourse.mc-stan.org/u/Arne_Henningsen)\
**Replies:** 0\
**Last updated:** [January 23, 2026, 8:58pm UTC](https://discourse.mc-stan.org/t/one-regression-equation-with-multiple-error-terms/40867 "2026-01-23T20:58:25Z")

</div>

We would like to estimate a non-linear regression model, e.g.: \\log y = f( x\_1 , x\_2, \\beta ) + u, where y, x\_1, and x\_2 are (observed) variables, \\beta is a vector of unknown parameters (to be estimated), f( \\cdot ) i…

---

## [Neal's funnel on a simplex](https://discourse.mc-stan.org/t/neals-funnel-on-a-simplex/35178)

<div class="topic-metadata">

**Author:** [@efharkin](https://discourse.mc-stan.org/u/efharkin)\
**Replies:** 3\
**Last updated:** [January 23, 2026, 8:30pm UTC](https://discourse.mc-stan.org/t/neals-funnel-on-a-simplex/35178 "2026-01-23T20:30:31Z")

</div>

Hi everyone, I’m trying to fit a hierarchical model that involves a Dirichlet distribution over an array of simplex\[3\]s, and I’m running into issues with both divergent transitions and hitting the max tree-depth. Given t…

---

## [Different Stan Versions Show Different Diagnostic Warnings](https://discourse.mc-stan.org/t/different-stan-versions-show-different-diagnostic-warnings/40852)

<div class="topic-metadata">

**Author:** [@dontknowwhy](https://discourse.mc-stan.org/u/dontknowwhy)\
**Replies:** 2\
**Last updated:** [January 21, 2026, 3:23am UTC](https://discourse.mc-stan.org/t/different-stan-versions-show-different-diagnostic-warnings/40852 "2026-01-21T03:23:11Z")

</div>

Hello Stan community, can someone help me understand the possible reasons for the different results described below please? I have cmdstanpy installed on two different laptops. I copied the data and code for a model fro…

---

## [Convergence issues with multivariate model in brms](https://discourse.mc-stan.org/t/convergence-issues-with-multivariate-model-in-brms/40835)

<div class="topic-metadata">

**Author:** [@sofia-pereira](https://discourse.mc-stan.org/u/sofia-pereira)\
**Replies:** 2\
**Last updated:** [January 20, 2026, 10:26am UTC](https://discourse.mc-stan.org/t/convergence-issues-with-multivariate-model-in-brms/40835 "2026-01-20T10:26:28Z")

</div>

Hello, I am new to modelling and attempting my first multivariate model in brms. I am modelling three different covarying DVs as a function of two shared predictors, though an important feature of this model is that my …

---

## [Brms: Right censored model is not converging, while a similar left censored model runs fine](https://discourse.mc-stan.org/t/brms-right-censored-model-is-not-converging-while-a-similar-left-censored-model-runs-fine/40779)

<div class="topic-metadata">

**Author:** [@Kara](https://discourse.mc-stan.org/u/Kara)\
**Replies:** 9\
**Last updated:** [January 19, 2026, 9:48am UTC](https://discourse.mc-stan.org/t/brms-right-censored-model-is-not-converging-while-a-similar-left-censored-model-runs-fine/40779 "2026-01-19T09:48:38Z")

</div>

Hello everyone and a happy new year! :) Never posted here before, but I´ll try my best. I am fitting a rather simple Bayesian linear mixed-effects model ins brms (R version 4.4.2 and brms\_2.23.0, on Win 11) I am analys…

---

## [Is it reasonable to model subject-level residual SD non-hierarchically in a hierarchical Stan model?](https://discourse.mc-stan.org/t/is-it-reasonable-to-model-subject-level-residual-sd-non-hierarchically-in-a-hierarchical-stan-model/40796)

<div class="topic-metadata">

**Author:** [@Fernando](https://discourse.mc-stan.org/u/Fernando)\
**Replies:** 4\
**Last updated:** [January 13, 2026, 6:29pm UTC](https://discourse.mc-stan.org/t/is-it-reasonable-to-model-subject-level-residual-sd-non-hierarchically-in-a-hierarchical-stan-model/40796 "2026-01-13T18:29:56Z")

</div>

Hello fellow stan users! I am doing a hierarchical analysis of behavioral data (mouse behavior) with 3 levels: individual, group and population. The model requires to estimate 2 parameters (U and S) modeled in log and l…

---

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

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