# \#specification

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

[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:** 2

---

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

---

## [Model comparison for choice in per-subject latent-state models with additional measurement channels (LOO vs two-stage approach)](https://discourse.mc-stan.org/t/model-comparison-for-choice-in-per-subject-latent-state-models-with-additional-measurement-channels-loo-vs-two-stage-approach/40839)

<div class="topic-metadata">

**Author:** [@Anastasios\_D](https://discourse.mc-stan.org/u/Anastasios_D)\
**Replies:** 3\
**Last updated:** [January 22, 2026, 8:07pm UTC](https://discourse.mc-stan.org/t/model-comparison-for-choice-in-per-subject-latent-state-models-with-additional-measurement-channels-loo-vs-two-stage-approach/40839 "2026-01-22T20:07:21Z")

</div>

Hi everyone, I’m fitting per-subject Bayesian latent-state models in Stan for a gambling task (153 trials per participant). Each participant is fit independently. At each trial, a latent emotional state Et evolves acco…

---

## [Bayesian IV model help](https://discourse.mc-stan.org/t/bayesian-iv-model-help/40791)

<div class="topic-metadata">

**Author:** [@brandon22](https://discourse.mc-stan.org/u/brandon22)\
**Replies:** 3\
**Last updated:** [January 21, 2026, 8:58am UTC](https://discourse.mc-stan.org/t/bayesian-iv-model-help/40791 "2026-01-21T08:58:32Z")

</div>

Hello, new to Bayesian statistics. I want to do an IV estimation. Roughly, I have two variables, an endogenous variable and an outcome variable. To estimate the direct effect of the endogenous variable on the outcome var…

---

## [Specifying normal priors on sum-to-zero vectors](https://discourse.mc-stan.org/t/specifying-normal-priors-on-sum-to-zero-vectors/40817)

<div class="topic-metadata">

**Author:** [@Yingnan\_Gao](https://discourse.mc-stan.org/u/Yingnan_Gao)\
**Replies:** 4\
**Last updated:** [January 20, 2026, 9:02pm UTC](https://discourse.mc-stan.org/t/specifying-normal-priors-on-sum-to-zero-vectors/40817 "2026-01-20T21:02:34Z")

</div>

Hello, I have been working on some multivariate hierarchical models involving sum-to-zero vectors. Specifically, I have a vector of means (of centered log ratios) that sums up to zero. I currently give them a normal pri…

---

## [Non-linear hurdle model](https://discourse.mc-stan.org/t/non-linear-hurdle-model/40794)

<div class="topic-metadata">

**Author:** [@Philipp\_Doebler](https://discourse.mc-stan.org/u/Philipp_Doebler)\
**Replies:** 2\
**Last updated:** [January 13, 2026, 9:28pm UTC](https://discourse.mc-stan.org/t/non-linear-hurdle-model/40794 "2026-01-13T21:28:05Z")

</div>

I am fitting an IRT-hurdle model in brms. A version without discrimination parameters (=factor loadings) was straightforward to specify. Based on Paul’s brms-IRT paper, I am trying to extend the syntax. The idea is, that…

---

## [Logistic regression inference issue](https://discourse.mc-stan.org/t/logistic-regression-inference-issue/40784)

<div class="topic-metadata">

**Author:** [@ramiro](https://discourse.mc-stan.org/u/ramiro)\
**Replies:** 5\
**Last updated:** [January 11, 2026, 11:04pm UTC](https://discourse.mc-stan.org/t/logistic-regression-inference-issue/40784 "2026-01-11T23:04:14Z")

</div>

I have a very basic logistic regression model: y\_n \\sim \\text{Bernoulli}(\\text{logit}^{-1}(\\alpha+\\beta x\_n)). \\alpha \\sim \\mathcal{N}(0,2.5) \\beta \\sim \\mathcal{N}(0,2.5) As a check I did simulation based callibr…

---

## [Hierarchical model to aggregate summary statistics and estimate a product of proportions ($P1 \\times P2$)](https://discourse.mc-stan.org/t/hierarchical-model-to-aggregate-summary-statistics-and-estimate-a-product-of-proportions-p1-times-p2/40798)

<div class="topic-metadata">

**Author:** [@arc\_circle\_square](https://discourse.mc-stan.org/u/arc_circle_square)\
**Replies:** 1\
**Last updated:** [January 9, 2026, 10:12pm UTC](https://discourse.mc-stan.org/t/hierarchical-model-to-aggregate-summary-statistics-and-estimate-a-product-of-proportions-p1-times-p2/40798 "2026-01-09T22:12:37Z")

</div>

I am trying to estimate the proportion of U.S. adults who use chatbots as a “friend.” (That’s not the exact RQ but it’s a good enough stand-in!) I am estimating this as a product of two probabilities: P = P1 \\times P2. …

---

## [Meta-analysis in brms -- Combining se() and mi()](https://discourse.mc-stan.org/t/meta-analysis-in-brms-combining-se-and-mi/16597)

<div class="topic-metadata">

**Author:** [@stu.donovan](https://discourse.mc-stan.org/u/stu.donovan)\
**Replies:** 3\
**Last updated:** [January 5, 2026, 4:09pm UTC](https://discourse.mc-stan.org/t/meta-analysis-in-brms-combining-se-and-mi/16597 "2026-01-05T16:09:52Z")

</div>

Hi there, I am using brms to estimate my fairly conventional meta-analysis model as follows: yi | se(sei, sigma = TRUE) ~ 1 + mods In my “new to brms” precociousness, I am now wondering if it’s possible to extend this …

---

## [Code optimization & reduce\_sum](https://discourse.mc-stan.org/t/code-optimization-reduce-sum/40752)

<div class="topic-metadata">

**Author:** [@Sheeta27](https://discourse.mc-stan.org/u/Sheeta27)\
**Replies:** 2\
**Last updated:** [December 18, 2025, 6:09pm UTC](https://discourse.mc-stan.org/t/code-optimization-reduce-sum/40752 "2025-12-18T18:09:05Z")

</div>

Hi Stan users! I’m modeling hierarchical tumor size measurements with the structure: measurement over time in tumor in organ in patient in study. I have about 150 000 measurements from 30,000 tumors across 22 studies. I…

---

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

---

## [Generalized Extreme Value distribution](https://discourse.mc-stan.org/t/generalized-extreme-value-distribution/40694)

<div class="topic-metadata">

**Author:** [@fabio](https://discourse.mc-stan.org/u/fabio)\
**Replies:** 6\
**Last updated:** [December 9, 2025, 8:40am UTC](https://discourse.mc-stan.org/t/generalized-extreme-value-distribution/40694 "2025-12-09T08:40:03Z")

</div>

Dear community, since I’d rather not reinvent the wheel (especially when the result would likely be a sub-optimal one), I’m wondering whether someone has already implemented functions for the Generalized Extreme Value (…

---

## [QA/QC on a weird brms model](https://discourse.mc-stan.org/t/qa-qc-on-a-weird-brms-model/40697)

<div class="topic-metadata">

**Author:** [@maxgotts](https://discourse.mc-stan.org/u/maxgotts)\
**Replies:** 2\
**Last updated:** [December 2, 2025, 11:55pm UTC](https://discourse.mc-stan.org/t/qa-qc-on-a-weird-brms-model/40697 "2025-12-02T23:55:39Z")

</div>

Hi Stan forum, If possible, I would love to have someone review my brms model to make sure it is doing what I want it to do! The model is fairly simple (it’s just 2 regressions), but it looks kind of weird the way I’ve …

---

## [Parameters that depend on missing values](https://discourse.mc-stan.org/t/parameters-that-depend-on-missing-values/40674)

<div class="topic-metadata">

**Author:** [@Saul\_Ortiz](https://discourse.mc-stan.org/u/Saul_Ortiz)\
**Replies:** 2\
**Last updated:** [December 1, 2025, 10:12pm UTC](https://discourse.mc-stan.org/t/parameters-that-depend-on-missing-values/40674 "2025-12-01T22:12:25Z")

</div>

I have this simple regression model y\_{ij} = \\mu\_{i} + x\_{ij}^{T}\\beta + e\_{ij}, where e\_{ij} \\sim N(0, \\sigma^2\_{i}) and e\_{ij}, e\_{ij'} are independent. i indexes ‘regions’: i=1, 2, \\ldots, K and j indexes instances …

---

## [Issue specifying a custom ordinal family](https://discourse.mc-stan.org/t/issue-specifying-a-custom-ordinal-family/40689)

<div class="topic-metadata">

**Author:** [@yuee](https://discourse.mc-stan.org/u/yuee)\
**Replies:** 0\
**Last updated:** [December 1, 2025, 2:45am UTC](https://discourse.mc-stan.org/t/issue-specifying-a-custom-ordinal-family/40689 "2025-12-01T02:45:07Z")

</div>

I am trying to specify a hurdle adjacent category shift model, but whenever specials = "ordinal" is supplied, brm will generate a block of unfinished function - as a custom family is not recognized in stan\_ordinal\_lpmf().…

---

## [Hierarchical Behavioural Model Specification- hyperparameters/ priors on groups or subjects](https://discourse.mc-stan.org/t/hierarchical-behavioural-model-specification-hyperparameters-priors-on-groups-or-subjects/40675)

<div class="topic-metadata">

**Author:** [@i-b](https://discourse.mc-stan.org/u/i-b)\
**Replies:** 2\
**Last updated:** [November 22, 2025, 7:01pm UTC](https://discourse.mc-stan.org/t/hierarchical-behavioural-model-specification-hyperparameters-priors-on-groups-or-subjects/40675 "2025-11-22T19:01:06Z")

</div>

Hello! I’m seeking guidance in how to specifiy a hierarchical approach to modelling RL behavioural data from patient groups. I don’t have the raw data to share; however for each participant, we have two data aquisition…

---

## [Ragged array of simplexes](https://discourse.mc-stan.org/t/ragged-array-of-simplexes/35748)

<div class="topic-metadata">

**Author:** [@d\_provasi](https://discourse.mc-stan.org/u/d_provasi)\
**Replies:** 21\
**Last updated:** [November 20, 2025, 2:42pm UTC](https://discourse.mc-stan.org/t/ragged-array-of-simplexes/35748 "2025-11-20T14:42:37Z")

</div>

Hello, I need to define M simplexes of different length. As far as I understand the suggested approach for ragged data is to use a single list of values, with a separate data structure indicating the sizes of each suba…

---

## [Chance-corrected beta binomial model for signal detection theory analysis of replicated n-AFC discrimination test](https://discourse.mc-stan.org/t/chance-corrected-beta-binomial-model-for-signal-detection-theory-analysis-of-replicated-n-afc-discrimination-test/40616)

<div class="topic-metadata">

**Author:** [@kilian](https://discourse.mc-stan.org/u/kilian)\
**Replies:** 3\
**Last updated:** [November 10, 2025, 10:01am UTC](https://discourse.mc-stan.org/t/chance-corrected-beta-binomial-model-for-signal-detection-theory-analysis-of-replicated-n-afc-discrimination-test/40616 "2025-11-10T10:01:20Z")

</div>

I would like to analyze data from a replicated n-alternative forced choice (n-AFC) discrimination test with brms in R. There are frequentist ways of this signal detection theory / sensometrics analysis (e.g., in the sen…

---

## [Cannot initiate sampling in interval censored model when specifying lower bound on variance](https://discourse.mc-stan.org/t/cannot-initiate-sampling-in-interval-censored-model-when-specifying-lower-bound-on-variance/40558)

<div class="topic-metadata">

**Author:** [@mariobecerra](https://discourse.mc-stan.org/u/mariobecerra)\
**Replies:** 4\
**Last updated:** [October 30, 2025, 2:13pm UTC](https://discourse.mc-stan.org/t/cannot-initiate-sampling-in-interval-censored-model-when-specifying-lower-bound-on-variance/40558 "2025-10-30T14:13:47Z")

</div>

Hello. I am trying to fit a heteroscedastic ANOVA model using brms. The responses are interval censored, meaning that I only know the upper and lower bound of the values. The code to simulate the dataset is below. I si…

---

## [Linear and nonlinear model specifications give different results](https://discourse.mc-stan.org/t/linear-and-nonlinear-model-specifications-give-different-results/40477)

<div class="topic-metadata">

**Author:** [@Todd\_Yoder](https://discourse.mc-stan.org/u/Todd_Yoder)\
**Replies:** 2\
**Last updated:** [October 16, 2025, 1:41pm UTC](https://discourse.mc-stan.org/t/linear-and-nonlinear-model-specifications-give-different-results/40477 "2025-10-16T13:41:12Z")

</div>

Should a mathematically linear model yield the same results regardless of whether it is specified in brms as linear or nonlinear? I tested a logistic regression model with a horseshoe prior. I tried the same mathematica…

---

## [How to make sure multiplier is above zero](https://discourse.mc-stan.org/t/how-to-make-sure-multiplier-is-above-zero/40449)

<div class="topic-metadata">

**Author:** [@yanmin](https://discourse.mc-stan.org/u/yanmin)\
**Replies:** 2\
**Last updated:** [October 14, 2025, 12:50am UTC](https://discourse.mc-stan.org/t/how-to-make-sure-multiplier-is-above-zero/40449 "2025-10-14T00:50:45Z")

</div>

my model is as follows, \\begin{align\*} &\\Pr(y = 1) = \\text{logit}^{-1}(\\text{predictor}) \\\\ &\\text{predictor} = \\alpha + \\beta\_{\\text{province}} + \\gamma\_{\\text{age}} + \\delta\_{\\text{gender}} + \\epsilon\_{\\text{hukou}} …

---

## [Drop draws below a threshold rather than setting a lower bound on a prior for nu](https://discourse.mc-stan.org/t/drop-draws-below-a-threshold-rather-than-setting-a-lower-bound-on-a-prior-for-nu/40476)

<div class="topic-metadata">

**Author:** [@Solomon](https://discourse.mc-stan.org/u/Solomon)\
**Replies:** 4\
**Last updated:** [October 9, 2025, 1:17pm UTC](https://discourse.mc-stan.org/t/drop-draws-below-a-threshold-rather-than-setting-a-lower-bound-on-a-prior-for-nu/40476 "2025-10-09T13:17:27Z")

</div>

Say I have some fat-tail Student-t data, I fit a model using the Student-t likelihood, and the bulk of the \\nu posterior is sitting well in the low-end of the range. Further say I want to use those posterior draws from \\…

---

## [Modelling data from EEG electrodes](https://discourse.mc-stan.org/t/modelling-data-from-eeg-electrodes/40440)

<div class="topic-metadata">

**Author:** [@Daniele\_Scanzi](https://discourse.mc-stan.org/u/Daniele_Scanzi)\
**Replies:** 4\
**Last updated:** [October 7, 2025, 3:59pm UTC](https://discourse.mc-stan.org/t/modelling-data-from-eeg-electrodes/40440 "2025-10-07T15:59:57Z")

</div>

Hi there, I am trying to model EEG data and I am struggling in conceptualising/implementing a model that accounts for the recording of multiple channel within participants. I’ll explain better. I have a dataset containi…

---

## [Heckprobit on Stan](https://discourse.mc-stan.org/t/heckprobit-on-stan/40434)

<div class="topic-metadata">

**Author:** [@RobertoCerina](https://discourse.mc-stan.org/u/RobertoCerina)\
**Replies:** 2\
**Last updated:** [October 2, 2025, 7:53pm UTC](https://discourse.mc-stan.org/t/heckprobit-on-stan/40434 "2025-10-02T19:53:18Z")

</div>

I\[1\] have coded up the bivariate probit with sample selection (“Heckprobit” as it is known on STATA - see here and here for examples) in Stan. See the Stan implementation below, and attached are the two datasets from STA…

---

## [Truncated cumulative multivariate normal?](https://discourse.mc-stan.org/t/truncated-cumulative-multivariate-normal/20957)

<div class="topic-metadata">

**Author:** [@Joshua\_Pritikin](https://discourse.mc-stan.org/u/Joshua_Pritikin)\
**Replies:** 17\
**Last updated:** [October 1, 2025, 12:11pm UTC](https://discourse.mc-stan.org/t/truncated-cumulative-multivariate-normal/20957 "2025-10-01T12:11:02Z")

</div>

I need normal\_lcdf(...)T\[l,u\], but multivariate with dense covariance. If this is not available yet, what work items would it entail to add? Thanks.

---

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

---

## [\`surv\_jm\` estimates do not match those in \`simjm\`](https://discourse.mc-stan.org/t/surv-jm-estimates-do-not-match-those-in-simjm/40419)

<div class="topic-metadata">

**Author:** [@mattwilliamson13](https://discourse.mc-stan.org/u/mattwilliamson13)\
**Replies:** 2\
**Last updated:** [September 26, 2025, 8:22pm UTC](https://discourse.mc-stan.org/t/surv-jm-estimates-do-not-match-those-in-simjm/40419 "2025-09-26T20:22:49Z")

</div>

Hi All, I’ve been fitting joint longitudinal models with stan\_jm, but wanted to make sure that my model was well-calibrated. I’ve been using simjm (thanks @sambrilleman!) to generate data with known parameter estimate…

---

## [Setting nug for GP regressions](https://discourse.mc-stan.org/t/setting-nug-for-gp-regressions/40369)

<div class="topic-metadata">

**Author:** [@jochens](https://discourse.mc-stan.org/u/jochens)\
**Replies:** 2\
**Last updated:** [September 16, 2025, 6:03pm UTC](https://discourse.mc-stan.org/t/setting-nug-for-gp-regressions/40369 "2025-09-16T18:03:34Z")

</div>

I sometimes receive the following error when generating conditional effects after training a GP regression model like brm(y ~ gp(x)) Error: The Gaussian process covariance matrix is not positive definite. This occurs f…

---

## [Ordinal regression: opposite signs of a coefficient with families cumulative and cratio](https://discourse.mc-stan.org/t/ordinal-regression-opposite-signs-of-a-coefficient-with-families-cumulative-and-cratio/40309)

<div class="topic-metadata">

**Author:** [@drjhw1](https://discourse.mc-stan.org/u/drjhw1)\
**Replies:** 2\
**Last updated:** [September 12, 2025, 10:32am UTC](https://discourse.mc-stan.org/t/ordinal-regression-opposite-signs-of-a-coefficient-with-families-cumulative-and-cratio/40309 "2025-09-12T10:32:44Z")

</div>

I have a data-set with a highly-skewed response that has distinct ceiling and floor effects. So, I thought a possible way to account for these features could be to transform them to ranked categories and analyse them wit…

---

## [diagSPD for Matérn GP kernels other than 3/2](https://discourse.mc-stan.org/t/diagspd-for-matern-gp-kernels-other-than-3-2/37011)

<div class="topic-metadata">

**Author:** [@Peter.Stewart](https://discourse.mc-stan.org/u/Peter.Stewart)\
**Replies:** 15\
**Last updated:** [September 12, 2025, 8:14am UTC](https://discourse.mc-stan.org/t/diagspd-for-matern-gp-kernels-other-than-3-2/37011 "2025-09-12T08:14:12Z")

</div>

Hi everyone, I’ve been fitting some Gaussian Process models using the Hilbert space approximation, adapting code from the tutorials by @avehtari here and here. I would like to fit a model which uses a Matérn 1/2 kernel,…

---

## [Monotonic splines in brms?](https://discourse.mc-stan.org/t/monotonic-splines-in-brms/19906)

<div class="topic-metadata">

**Author:** [@hwilde](https://discourse.mc-stan.org/u/hwilde)\
**Replies:** 6\
**Last updated:** [September 3, 2025, 8:16pm UTC](https://discourse.mc-stan.org/t/monotonic-splines-in-brms/19906 "2025-09-03T20:16:16Z")

</div>

Is there a way to force monotonicity upon a spline in a brms model? Due to sparsity at either end of a continuous covariate, we are seeing an up/down tick which we believe to be overfitting / bad fitting and would like t…

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

[Next page](https://discourse.mc-stan.org/tag/specification/17.md?match_all_tags=true&page=2&tags%5B%5D=specification)
