# \#fitting-issues

**URL:** https://discourse.mc-stan.org/tag/fitting-issues/16.md?match_all_tags=true&page=5&tags%5B%5D=fitting-issues

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

**Page:** 6

---

## [How to change adapt\_delta on pystan 3.9.1?](https://discourse.mc-stan.org/t/how-to-change-adapt-delta-on-pystan-3-9-1/34945)

<div class="topic-metadata">

**Author:** [@confused\_dude](https://discourse.mc-stan.org/u/confused_dude)\
**Replies:** 4\
**Last updated:** [September 16, 2024, 1:07am UTC](https://discourse.mc-stan.org/t/how-to-change-adapt-delta-on-pystan-3-9-1/34945 "2024-09-16T01:07:24Z")

</div>

Hi everyone. Basically, I am new to Pystan, I used to work with Rstan. In R stan this was easy: ...,control = list(adapt\_delta = 0.999, stepsize = 0.001, max\_treedepth = 12) It was also easy on the previous versions o…

---

## [Help with Hierarchical Changepoint Model in rstan: Divergent Transitions and BFMI Warnings](https://discourse.mc-stan.org/t/help-with-hierarchical-changepoint-model-in-rstan-divergent-transitions-and-bfmi-warnings/36553)

<div class="topic-metadata">

**Author:** [@yksakana](https://discourse.mc-stan.org/u/yksakana)\
**Replies:** 4\
**Last updated:** [September 14, 2024, 2:59am UTC](https://discourse.mc-stan.org/t/help-with-hierarchical-changepoint-model-in-rstan-divergent-transitions-and-bfmi-warnings/36553 "2024-09-14T02:59:48Z")

</div>

I am new to rstan and having difficulty specifying a hierarchical model for changepoint analysis in fish movement data. I would like assistance with model specification or reparameterization, as I am encountering the fol…

---

## [Model specification with random intercept for group vs. predicting group-level mean](https://discourse.mc-stan.org/t/model-specification-with-random-intercept-for-group-vs-predicting-group-level-mean/36532)

<div class="topic-metadata">

**Author:** [@kthayashi](https://discourse.mc-stan.org/u/kthayashi)\
**Replies:** 1\
**Last updated:** [September 9, 2024, 11:26pm UTC](https://discourse.mc-stan.org/t/model-specification-with-random-intercept-for-group-vs-predicting-group-level-mean/36532 "2024-09-09T23:26:48Z")

</div>

Dear Stan community - I have a modeling problem that I would love to get some input on. I am working with experimental data on plant performance across environmentally variable sites, and am trying to fit a model along t…

---

## [Help with hierarchically modeling parameters of a nonlinear model](https://discourse.mc-stan.org/t/help-with-hierarchically-modeling-parameters-of-a-nonlinear-model/36191)

<div class="topic-metadata">

**Author:** [@kthayashi](https://discourse.mc-stan.org/u/kthayashi)\
**Replies:** 10\
**Last updated:** [September 8, 2024, 6:13pm UTC](https://discourse.mc-stan.org/t/help-with-hierarchically-modeling-parameters-of-a-nonlinear-model/36191 "2024-09-08T18:13:42Z")

</div>

Dear Stan community, I’m struggling to fit a model in which linear models are hierarchically attached to parameters of a nonlinear model. The issue is that the model sometimes runs smoothly and produces sensible estimat…

---

## [Is forcing correlation between parameter values allowed in bayesian regression](https://discourse.mc-stan.org/t/is-forcing-correlation-between-parameter-values-allowed-in-bayesian-regression/36494)

<div class="topic-metadata">

**Author:** [@jweverka](https://discourse.mc-stan.org/u/jweverka)\
**Replies:** 1\
**Last updated:** [September 8, 2024, 5:22pm UTC](https://discourse.mc-stan.org/t/is-forcing-correlation-between-parameter-values-allowed-in-bayesian-regression/36494 "2024-09-08T17:22:03Z")

</div>

I am using bayesian nonlinear regression in brms to fit some model parameters, and I’m running into some issues getting MCMC chains to converge. I know this is because of some model specification issues and I’m looking f…

---

## [Marginalize out discrete intermediate variable and possibility of in-chain parallelization](https://discourse.mc-stan.org/t/marginalize-out-discrete-intermediate-variable-and-possibility-of-in-chain-parallelization/36267)

<div class="topic-metadata">

**Author:** [@buf](https://discourse.mc-stan.org/u/buf)\
**Replies:** 7\
**Last updated:** [September 6, 2024, 9:59am UTC](https://discourse.mc-stan.org/t/marginalize-out-discrete-intermediate-variable-and-possibility-of-in-chain-parallelization/36267 "2024-09-06T09:59:48Z")

</div>

Hi everyone, I am working on a model with continuous parameters that creates a discrete “intermediate variable” which causes some problems. I asked regarding this issue a while ago here: Slow sampling for phenological m…

---

## [Improving PPC Fit in MELS model (brms) when using Multimodal Data](https://discourse.mc-stan.org/t/improving-ppc-fit-in-mels-model-brms-when-using-multimodal-data/36417)

<div class="topic-metadata">

**Author:** [@busra\_yelbuz](https://discourse.mc-stan.org/u/busra_yelbuz)\
**Replies:** 4\
**Last updated:** [September 3, 2024, 4:44pm UTC](https://discourse.mc-stan.org/t/improving-ppc-fit-in-mels-model-brms-when-using-multimodal-data/36417 "2024-09-03T16:44:16Z")

</div>

Hi everyone, First time brms and stan user here! I’m having some problems with my mixed effects locations scale (MELS) model fit and would really appreciate any advice. More specifically, I’m trying to explore the relat…

---

## [HMM always stuck from the beginning of sampling](https://discourse.mc-stan.org/t/hmm-always-stuck-from-the-beginning-of-sampling/36475)

<div class="topic-metadata">

**Author:** [@Fay](https://discourse.mc-stan.org/u/Fay)\
**Replies:** 1\
**Last updated:** [September 3, 2024, 4:01pm UTC](https://discourse.mc-stan.org/t/hmm-always-stuck-from-the-beginning-of-sampling/36475 "2024-09-03T16:01:59Z")

</div>

Dear Stan programmers, I’m running a series of HMMs with different likelihood specifications, which do not have complex structure. The basic one works, but those with poisson and tobit likelihood always stuck from the v…

---

## [Improving pp\_check results Poisson model](https://discourse.mc-stan.org/t/improving-pp-check-results-poisson-model/36420)

<div class="topic-metadata">

**Author:** [@lamagoga](https://discourse.mc-stan.org/u/lamagoga)\
**Replies:** 5\
**Last updated:** [September 2, 2024, 1:00pm UTC](https://discourse.mc-stan.org/t/improving-pp-check-results-poisson-model/36420 "2024-09-02T13:00:51Z")

</div>

Hi, I am trying to build a model to analyze count data (errors in sentences produced by language learners; sentences have different lengths). Unfortunately, I am having problems modeling the brms model correctly. The r…

---

## [Rejecting initial value error message](https://discourse.mc-stan.org/t/rejecting-initial-value-error-message/36217)

<div class="topic-metadata">

**Author:** [@jdi1125](https://discourse.mc-stan.org/u/jdi1125)\
**Replies:** 1\
**Last updated:** [August 22, 2024, 8:21am UTC](https://discourse.mc-stan.org/t/rejecting-initial-value-error-message/36217 "2024-08-22T08:21:03Z")

</div>

Hi, I am trying to fit a non-linear formula model, specifically a hyperbolic function for delayed discounting using hiearchical model. I want to estimate logk with a covariate (factor variable with 9 levels), but it kee…

---

## [Rejecting initial value - Gradient evaluated at the initial value is not finite](https://discourse.mc-stan.org/t/rejecting-initial-value-gradient-evaluated-at-the-initial-value-is-not-finite/36298)

<div class="topic-metadata">

**Author:** [@seanufo](https://discourse.mc-stan.org/u/seanufo)\
**Replies:** 1\
**Last updated:** [August 22, 2024, 5:07am UTC](https://discourse.mc-stan.org/t/rejecting-initial-value-gradient-evaluated-at-the-initial-value-is-not-finite/36298 "2024-08-22T05:07:43Z")

</div>

I’m trying to fit a hierachical model described by this paper, A Bayesian spatio-temporal model of COVID-19 spread in England | Scientific Reports. Yet I can’t seem to figure out this message: Chain 1: Rejecting initial…

---

## [Validity of ordinal models without including unequal variances model](https://discourse.mc-stan.org/t/validity-of-ordinal-models-without-including-unequal-variances-model/36299)

<div class="topic-metadata">

**Author:** [@Mohammed\_Takweeni](https://discourse.mc-stan.org/u/Mohammed_Takweeni)\
**Replies:** 0\
**Last updated:** [August 18, 2024, 2:34pm UTC](https://discourse.mc-stan.org/t/validity-of-ordinal-models-without-including-unequal-variances-model/36299 "2024-08-18T14:34:02Z")

</div>

Hello everyone I hope you are doing well I have run a bayesian multilevel model. The equal variances model, and specific effects model worked well. However, the unequal variances model seem to take a very long time. I …

---

## [Issues with covariance estimation for matrix derived product](https://discourse.mc-stan.org/t/issues-with-covariance-estimation-for-matrix-derived-product/36106)

<div class="topic-metadata">

**Author:** [@CdeGroot](https://discourse.mc-stan.org/u/CdeGroot)\
**Replies:** 4\
**Last updated:** [August 14, 2024, 12:26pm UTC](https://discourse.mc-stan.org/t/issues-with-covariance-estimation-for-matrix-derived-product/36106 "2024-08-14T12:26:42Z")

</div>

Hi Stan community, I am fitting a model in stan where a parameter of interest needs to be derived based on products in matrix X and need to be assigned to matrix Y, so the covariance can be estimated with other paramete…

---

## [Help understanding spline and extreme estimations](https://discourse.mc-stan.org/t/help-understanding-spline-and-extreme-estimations/35988)

<div class="topic-metadata">

**Author:** [@rtpanik22](https://discourse.mc-stan.org/u/rtpanik22)\
**Replies:** 4\
**Last updated:** [August 8, 2024, 10:00pm UTC](https://discourse.mc-stan.org/t/help-understanding-spline-and-extreme-estimations/35988 "2024-08-08T22:00:38Z")

</div>

Hi, rstan and modeling pros – I am having issue with a count time series model that contains a spline producing one-off, extremely large estimates at certain instances. Here is some background: The data + model: My d…

---

## [Apparently equivalent noncentered parameterization, different outcomes](https://discourse.mc-stan.org/t/apparently-equivalent-noncentered-parameterization-different-outcomes/36157)

<div class="topic-metadata">

**Author:** [@ashmadoo](https://discourse.mc-stan.org/u/ashmadoo)\
**Replies:** 2\
**Last updated:** [August 8, 2024, 12:50pm UTC](https://discourse.mc-stan.org/t/apparently-equivalent-noncentered-parameterization-different-outcomes/36157 "2024-08-08T12:50:32Z")

</div>

I’m having a funny issue with a hierarchical model I’m fitting in Rstan. It runs fine, and the posterior predictive checks all seem to check out. The model is a negative binomial regression with three crossed random effe…

---

## [Model fitting in R stan](https://discourse.mc-stan.org/t/model-fitting-in-r-stan/36159)

<div class="topic-metadata">

**Author:** [@akurugu\_edward](https://discourse.mc-stan.org/u/akurugu_edward)\
**Replies:** 0\
**Last updated:** [August 7, 2024, 8:30pm UTC](https://discourse.mc-stan.org/t/model-fitting-in-r-stan/36159 "2024-08-07T20:30:47Z")

</div>

I am new to the R stan language but I had an ode compartmental which I wrote in R stan. Now I want to integrate it and fit my actual and observed data. Any help will be appreciated. This is the stan file code and the sta…

---

## [Mixture model with explained variable having non-identifiability issue](https://discourse.mc-stan.org/t/mixture-model-with-explained-variable-having-non-identifiability-issue/35290)

<div class="topic-metadata">

**Author:** [@ChiehTony](https://discourse.mc-stan.org/u/ChiehTony)\
**Replies:** 7\
**Last updated:** [August 1, 2024, 8:14pm UTC](https://discourse.mc-stan.org/t/mixture-model-with-explained-variable-having-non-identifiability-issue/35290 "2024-08-01T20:14:06Z")

</div>

Dear Stan community, I am experiencing issues with fitting a mixture regression model with explanatory variables. I believe the problem might be non-identifiability, which becomes more pronounced as the model complexity…

---

## [Is it possible to get an error with rhat() due to convergence problems?](https://discourse.mc-stan.org/t/is-it-possible-to-get-an-error-with-rhat-due-to-convergence-problems/36088)

<div class="topic-metadata">

**Author:** [@Cristrinaranjus](https://discourse.mc-stan.org/u/Cristrinaranjus)\
**Replies:** 3\
**Last updated:** [August 1, 2024, 12:55pm UTC](https://discourse.mc-stan.org/t/is-it-possible-to-get-an-error-with-rhat-due-to-convergence-problems/36088 "2024-08-01T12:55:04Z")

</div>

As a general context, within my doctoral thesis I am doing a simulation study to evaluate the statistical characteristics of the Bayesian and frequentist framework in the application of multilevel models to data from sin…

---

## [Simple linear fitting problem with two predictors](https://discourse.mc-stan.org/t/simple-linear-fitting-problem-with-two-predictors/36030)

<div class="topic-metadata">

**Author:** [@Hao\_YF](https://discourse.mc-stan.org/u/Hao_YF)\
**Replies:** 1\
**Last updated:** [July 30, 2024, 9:26pm UTC](https://discourse.mc-stan.org/t/simple-linear-fitting-problem-with-two-predictors/36030 "2024-07-30T21:26:24Z")

</div>

I am working on a linear fitting problem using Stan to analyze contributions from two sources (emitters) on two pollutants. The goal is to determine the emission ratios of the pollutants for both emitters and how the con…

---

## [NAs for the rhat values of Cholesky factor](https://discourse.mc-stan.org/t/nas-for-the-rhat-values-of-cholesky-factor/36040)

<div class="topic-metadata">

**Author:** [@Susanna\_Koivusaari](https://discourse.mc-stan.org/u/Susanna_Koivusaari)\
**Replies:** 1\
**Last updated:** [July 29, 2024, 2:06pm UTC](https://discourse.mc-stan.org/t/nas-for-the-rhat-values-of-cholesky-factor/36040 "2024-07-29T14:06:40Z")

</div>

Hi all, I’m new to brms and am trying to fit my first ever models. I was wondering if it is normal to have NAs for the rhat values of the Cholesky factor? Or does it mean my model has not converged successfully? See th…

---

## [Using Pathfinder (and other algorithms) to infer epidemiological delay distributions and to initialise Rt estimates](https://discourse.mc-stan.org/t/using-pathfinder-and-other-algorithms-to-infer-epidemiological-delay-distributions-and-to-initialise-rt-estimates/35929)

<div class="topic-metadata">

**Author:** [@athowes](https://discourse.mc-stan.org/u/athowes)\
**Replies:** 3\
**Last updated:** [July 22, 2024, 11:05am UTC](https://discourse.mc-stan.org/t/using-pathfinder-and-other-algorithms-to-infer-epidemiological-delay-distributions-and-to-initialise-rt-estimates/35929 "2024-07-22T11:05:19Z")

</div>

Hi Stan forum, I wanted to share a vignette about using the Laplace, ADVI, Pathfinder, and NUTS inference methods to fit epidemiological delay distributions. The vignette is for the epidist package, which uses brms as a…

---

## [Divergences when sampling from seemingly unrelated regressions](https://discourse.mc-stan.org/t/divergences-when-sampling-from-seemingly-unrelated-regressions/35661)

<div class="topic-metadata">

**Author:** [@Stuart\_Lacy](https://discourse.mc-stan.org/u/Stuart_Lacy)\
**Replies:** 3\
**Last updated:** [July 19, 2024, 9:31pm UTC](https://discourse.mc-stan.org/t/divergences-when-sampling-from-seemingly-unrelated-regressions/35661 "2024-07-19T21:31:39Z")

</div>

I have some data of 200 study participants belonging to two groups who completed a motor task twice, once for each hand. We derived 20 features from each task’s recording. The purpose is to identify which features diffe…

---

## [Can you fit the zero-inflated component of a model to a nonlinear expression in brms?](https://discourse.mc-stan.org/t/can-you-fit-the-zero-inflated-component-of-a-model-to-a-nonlinear-expression-in-brms/30014)

<div class="topic-metadata">

**Author:** [@keeps](https://discourse.mc-stan.org/u/keeps)\
**Replies:** 5\
**Last updated:** [July 19, 2024, 6:46am UTC](https://discourse.mc-stan.org/t/can-you-fit-the-zero-inflated-component-of-a-model-to-a-nonlinear-expression-in-brms/30014 "2024-07-19T06:46:59Z")

</div>

I am running a model and would like to fit the zero-inflated component of a ZIP model to a non-linear expression. The problem is illustrated in the following toy example: train \<- data.frame(fread("path/to/data/train.c…

---

## [Updating ode to new syntax. Exception: ode\_rk45: ode paramers and data is inf](https://discourse.mc-stan.org/t/updating-ode-to-new-syntax-exception-ode-rk45-ode-paramers-and-data-is-inf/35900)

<div class="topic-metadata">

**Author:** [@BjarkeHautop](https://discourse.mc-stan.org/u/BjarkeHautop)\
**Replies:** 1\
**Last updated:** [July 17, 2024, 8:09pm UTC](https://discourse.mc-stan.org/t/updating-ode-to-new-syntax-exception-ode-rk45-ode-paramers-and-data-is-inf/35900 "2024-07-17T20:09:06Z")

</div>

I’m trying to update some ode Stan code. My updated Stan code looks like this functions { vector sir(real t, vector y, real beta, real gamma, array\[\] int x\_i) { real S = y\[1\]; real I = y\[2\]; real R = y\[3\];…

---

## [Fitting count data with negative binomial - long tail](https://discourse.mc-stan.org/t/fitting-count-data-with-negative-binomial-long-tail/35828)

<div class="topic-metadata">

**Author:** [@CatarinaSerraGoncalves](https://discourse.mc-stan.org/u/CatarinaSerraGoncalves)\
**Replies:** 7\
**Last updated:** [July 16, 2024, 8:28am UTC](https://discourse.mc-stan.org/t/fitting-count-data-with-negative-binomial-long-tail/35828 "2024-07-16T08:28:38Z")

</div>

Hi, I am having difficulties setting up the model and understanding what i can do. As background I beach clean-up events where we recorded the total number of counts of debris - which is my response variable and am testi…

---

## [Multistate model does not always initialize](https://discourse.mc-stan.org/t/multistate-model-does-not-always-initialize/35155)

<div class="topic-metadata">

**Author:** [@Scolopaxminor79](https://discourse.mc-stan.org/u/Scolopaxminor79)\
**Replies:** 1\
**Last updated:** [July 10, 2024, 4:47am UTC](https://discourse.mc-stan.org/t/multistate-model-does-not-always-initialize/35155 "2024-07-10T04:47:38Z")

</div>

Hi all, I am hoping to get some ideas from folks - I am working on a multistate model to estimate bird mortality rates in different behavioral states (Following this paper: https://besjournals.onlinelibrary.wiley.com/do…

---

## [How to perform posterior predictive checks](https://discourse.mc-stan.org/t/how-to-perform-posterior-predictive-checks/35782)

<div class="topic-metadata">

**Author:** [@yanmin](https://discourse.mc-stan.org/u/yanmin)\
**Replies:** 1\
**Last updated:** [July 9, 2024, 1:19pm UTC](https://discourse.mc-stan.org/t/how-to-perform-posterior-predictive-checks/35782 "2024-07-09T13:19:29Z")

</div>

Dear Stan, I’d like to repelicate the figure 6.12 in the book, bayesian data analysis, written by gelman et al. Are there RStan codes for the figure? Thanks in advance.

---

## [The order of the data cause different fitting result](https://discourse.mc-stan.org/t/the-order-of-the-data-cause-different-fitting-result/35356)

<div class="topic-metadata">

**Author:** [@joyjoy](https://discourse.mc-stan.org/u/joyjoy)\
**Replies:** 5\
**Last updated:** [July 6, 2024, 8:37am UTC](https://discourse.mc-stan.org/t/the-order-of-the-data-cause-different-fitting-result/35356 "2024-07-06T08:37:19Z")

</div>

I changed the order of the data, sorted it by ID from smallest to largest, input it into the model after the same preprocessing, and got a completely different fitting result from before sorting. Why? fit\_m01\_1 \<- stan(…

---

## [Mixed effect beta regression in RStan](https://discourse.mc-stan.org/t/mixed-effect-beta-regression-in-rstan/35577)

<div class="topic-metadata">

**Author:** [@emily100](https://discourse.mc-stan.org/u/emily100)\
**Replies:** 2\
**Last updated:** [June 28, 2024, 10:36am UTC](https://discourse.mc-stan.org/t/mixed-effect-beta-regression-in-rstan/35577 "2024-06-28T10:36:13Z")

</div>

Hi all, I would be grateful for your assistance. I am trying to predict a patient’s score (on interval \[0,1\]) using a mixed effect beta regression model. \\text{logit}(\\mu\_{ij}) = \\beta\_0 + \\beta\_1 (x\_1)\_i + \\beta\_2 (x\_…

---

## [Error fitting model in Windows cmdstanr - metadata data type](https://discourse.mc-stan.org/t/error-fitting-model-in-windows-cmdstanr-metadata-data-type/35648)

<div class="topic-metadata">

**Author:** [@Stuart\_Lacy](https://discourse.mc-stan.org/u/Stuart_Lacy)\
**Replies:** 2\
**Last updated:** [June 26, 2024, 3:42pm UTC](https://discourse.mc-stan.org/t/error-fitting-model-in-windows-cmdstanr-metadata-data-type/35648 "2024-06-26T15:42:15Z")

</div>

I’ve installed cmdstanr on a windows laptop which seemed to go successfully, and I can compile models fine but I get a strange error when I come to sample from them. As a demonstration running the example model gives th…

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

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