# \#logistic-regression

**URL:** https://discourse.mc-stan.org/tag/logistic-regression/140.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)

---

## [Bayesian logistic regression workflow when facing complete separation](https://discourse.mc-stan.org/t/bayesian-logistic-regression-workflow-when-facing-complete-separation/40155)

<div class="topic-metadata">

**Author:** [@yjs](https://discourse.mc-stan.org/u/yjs)\
**Replies:** 3\
**Last updated:** [August 15, 2025, 3:05pm UTC](https://discourse.mc-stan.org/t/bayesian-logistic-regression-workflow-when-facing-complete-separation/40155 "2025-08-15T15:05:16Z")

</div>

With one year of experience in frequentist statistics, I recently dived into the world of Bayesian regression as my dataset has complete separation and confounding issues. Most discussions on solving the separation issue…

---

## [Logistic regression with brms: how to compute the credible interval of the predictor for a target probability](https://discourse.mc-stan.org/t/logistic-regression-with-brms-how-to-compute-the-credible-interval-of-the-predictor-for-a-target-probability/39973)

<div class="topic-metadata">

**Author:** [@romain\_guyon](https://discourse.mc-stan.org/u/romain_guyon)\
**Replies:** 2\
**Last updated:** [July 28, 2025, 2:35am UTC](https://discourse.mc-stan.org/t/logistic-regression-with-brms-how-to-compute-the-credible-interval-of-the-predictor-for-a-target-probability/39973 "2025-07-28T02:35:34Z")

</div>

Hi ! I am new to bayesian statistics so I might misunderstood completely things here. I am trying to fit my dose escalation preclinical data to a logistic regression and I would like to estimate the dose and associated…

---

## [Choice of regularizing prior for the cumulative probit](https://discourse.mc-stan.org/t/choice-of-regularizing-prior-for-the-cumulative-probit/39582)

<div class="topic-metadata">

**Author:** [@epkanol](https://discourse.mc-stan.org/u/epkanol)\
**Replies:** 4\
**Last updated:** [May 28, 2025, 8:05pm UTC](https://discourse.mc-stan.org/t/choice-of-regularizing-prior-for-the-cumulative-probit/39582 "2025-05-28T20:05:47Z")

</div>

I have a situation where I have a 7-item Likert scale, where each respondent answers 6 questions on the same subject (TAM). Essentially the same setup as in this question: Partial pooling on ordinal response (cumulative…

---

## [Find the predictor value at which posterior\_epred(model) = x (in a multilevel logistic regression)](https://discourse.mc-stan.org/t/find-the-predictor-value-at-which-posterior-epred-model-x-in-a-multilevel-logistic-regression/38640)

<div class="topic-metadata">

**Author:** [@Ladislas](https://discourse.mc-stan.org/u/Ladislas)\
**Replies:** 8\
**Last updated:** [February 25, 2025, 3:30pm UTC](https://discourse.mc-stan.org/t/find-the-predictor-value-at-which-posterior-epred-model-x-in-a-multilevel-logistic-regression/38640 "2025-02-25T15:30:56Z")

</div>

Context Hello, I am modelling behavioural data with a multilevel model specified as: model \<- brm( formula = resp ~ 1 + test \* stim \* trial + (1 + test \* stim \* trial | dyad / ppt), family = bernoulli(link = "l…

---

## [Separable logistic regression performance optimizations](https://discourse.mc-stan.org/t/separable-logistic-regression-performance-optimizations/35628)

<div class="topic-metadata">

**Author:** [@Paul\_Jones](https://discourse.mc-stan.org/u/Paul_Jones)\
**Replies:** 2\
**Last updated:** [June 25, 2024, 11:14pm UTC](https://discourse.mc-stan.org/t/separable-logistic-regression-performance-optimizations/35628 "2024-06-25T23:14:12Z")

</div>

I’m experiencing significant performance slowdowns in STAN when solving logistic regression problems with separable or near-separable data. Performance is important, so we have implemented a few optimizations. We use QR…

---

## [Fitting logistic regression models where the dependent variable is proportions in brms](https://discourse.mc-stan.org/t/fitting-logistic-regression-models-where-the-dependent-variable-is-proportions-in-brms/34477)

<div class="topic-metadata">

**Author:** [@sayianka](https://discourse.mc-stan.org/u/sayianka)\
**Replies:** 3\
**Last updated:** [March 18, 2024, 2:06pm UTC](https://discourse.mc-stan.org/t/fitting-logistic-regression-models-where-the-dependent-variable-is-proportions-in-brms/34477 "2024-03-18T14:06:27Z")

</div>

I am working with survey data, from the DHS, where I aim to fit a logistic regression model to explain neonatal mortality. I clean the data in a way that I compute the proportion of neonatal mortality per region(county)…

---

## [Warnings after running brm](https://discourse.mc-stan.org/t/warnings-after-running-brm/32349)

<div class="topic-metadata">

**Author:** [@leoservino](https://discourse.mc-stan.org/u/leoservino)\
**Replies:** 6\
**Last updated:** [August 14, 2023, 12:53pm UTC](https://discourse.mc-stan.org/t/warnings-after-running-brm/32349 "2023-08-14T12:53:20Z")

</div>

I am running a phylogenetic logistic regression using brm from brms package. My data consists on a categorical predictor (values 0, 1 and 2) and a binary response variabe (values 1 and 2) plus adding the effect of phylog…

---

## [Why does VB struggle with bernoulli(inv\_logit(...)) vs. bernoulli\_logit(...)?](https://discourse.mc-stan.org/t/why-does-vb-struggle-with-bernoulli-inv-logit-vs-bernoulli-logit/32365)

<div class="topic-metadata">

**Author:** [@loesten](https://discourse.mc-stan.org/u/loesten)\
**Replies:** 5\
**Last updated:** [August 10, 2023, 5:57pm UTC](https://discourse.mc-stan.org/t/why-does-vb-struggle-with-bernoulli-inv-logit-vs-bernoulli-logit/32365 "2023-08-10T17:57:37Z")

</div>

I’m implementing an IRT model and have followed the relevant chapter in the user guide to the letter (except for changing the kk index to ii, to match edstan’s format). Hence the model block is simply model { alpha ~ …

---

## [Divergent transitions in logistic GAMM with factor smooth](https://discourse.mc-stan.org/t/divergent-transitions-in-logistic-gamm-with-factor-smooth/31938)

<div class="topic-metadata">

**Author:** [@qdread](https://discourse.mc-stan.org/u/qdread)\
**Replies:** 2\
**Last updated:** [July 11, 2023, 2:37pm UTC](https://discourse.mc-stan.org/t/divergent-transitions-in-logistic-gamm-with-factor-smooth/31938 "2023-07-11T14:37:32Z")

</div>

I am fitting a logistic regression using brms. For background, this is an assay where groups of 50 flies are allowed to choose between a control stimulus and some kind of chemical attractant. There are 7 different attrac…

---

## [Loo\_moment\_match for jagsUI models](https://discourse.mc-stan.org/t/loo-moment-match-for-jagsui-models/31928)

<div class="topic-metadata">

**Author:** [@Ana\_Barros](https://discourse.mc-stan.org/u/Ana_Barros)\
**Replies:** 6\
**Last updated:** [July 4, 2023, 5:30am UTC](https://discourse.mc-stan.org/t/loo-moment-match-for-jagsui-models/31928 "2023-07-04T05:30:12Z")

</div>

Hi everyone! I know this forum is mostly dedicated to stan, but maybe you can help me out. I want to use loo for model ranking but my models are a jagsUI object. Also, all models are returning a warning for the pareto-k…

---

## [Hierarchical polynomial regression, data type errors](https://discourse.mc-stan.org/t/hierarchical-polynomial-regression-data-type-errors/31765)

<div class="topic-metadata">

**Author:** [@g\_haines](https://discourse.mc-stan.org/u/g_haines)\
**Replies:** 0\
**Last updated:** [June 16, 2023, 2:24pm UTC](https://discourse.mc-stan.org/t/hierarchical-polynomial-regression-data-type-errors/31765 "2023-06-16T14:24:32Z")

</div>

hello all, I am trying to create a hierarchical second-order polynomial model on the logit scale, using cmdstanr. I thought that this would be fairly straightforward if I adapted the example code in the user guide for h…

---

## [Brms custom formula for logistic regression](https://discourse.mc-stan.org/t/brms-custom-formula-for-logistic-regression/31539)

<div class="topic-metadata">

**Author:** [@Noel](https://discourse.mc-stan.org/u/Noel)\
**Replies:** 3\
**Last updated:** [May 29, 2023, 8:02pm UTC](https://discourse.mc-stan.org/t/brms-custom-formula-for-logistic-regression/31539 "2023-05-29T20:02:34Z")

</div>

Hello, I am new to brms and, to a large extent, to Bayesian data analysis and would appreciate some guidance on the following topic. I wish to analyse data collected in a psychophysical experiment which involves asking…

---

## [Joint model specification, simple question](https://discourse.mc-stan.org/t/joint-model-specification-simple-question/30868)

<div class="topic-metadata">

**Author:** [@Wolsing](https://discourse.mc-stan.org/u/Wolsing)\
**Replies:** 2\
**Last updated:** [March 28, 2023, 7:06am UTC](https://discourse.mc-stan.org/t/joint-model-specification-simple-question/30868 "2023-03-28T07:06:43Z")

</div>

I want to include longitudinal information from a secondary endpoint into a primary binary endpoint. To do this, we have the following model As suggested in “Bayesian Workflow” (Gelman et. al 2020) I have of course f…

---

## [Bayesian Logistic Regression and model comparison](https://discourse.mc-stan.org/t/bayesian-logistic-regression-and-model-comparison/30682)

<div class="topic-metadata">

**Author:** [@KB\_P8](https://discourse.mc-stan.org/u/KB_P8)\
**Replies:** 4\
**Last updated:** [March 10, 2023, 6:05pm UTC](https://discourse.mc-stan.org/t/bayesian-logistic-regression-and-model-comparison/30682 "2023-03-10T18:05:59Z")

</div>

I asked how to conduct a Bayesian logistic regression in another post. I have been advised to use the brms R package. I have conducted this analysis, but being a beginner in statistics and coding, I need to know if my a…

---

## [Logistic Regression without a Gold Standard/Error in Observed Classification](https://discourse.mc-stan.org/t/logistic-regression-without-a-gold-standard-error-in-observed-classification/28644)

<div class="topic-metadata">

**Author:** [@wgoette](https://discourse.mc-stan.org/u/wgoette)\
**Replies:** 6\
**Last updated:** [September 9, 2022, 8:50pm UTC](https://discourse.mc-stan.org/t/logistic-regression-without-a-gold-standard-error-in-observed-classification/28644 "2022-09-09T20:50:55Z")

</div>

Context of Problem I’m trying to specify a logistic regression model that incorporates some amount of unknown classification error in the sample data. The issue of diagnostic uncertainty is an obvious problem, but I’ve …

---

## [K Fold Cross Validation with Logistic Regression Model](https://discourse.mc-stan.org/t/k-fold-cross-validation-with-logistic-regression-model/27109)

<div class="topic-metadata">

**Author:** [@mdanb](https://discourse.mc-stan.org/u/mdanb)\
**Replies:** 4\
**Last updated:** [April 12, 2022, 7:57am UTC](https://discourse.mc-stan.org/t/k-fold-cross-validation-with-logistic-regression-model/27109 "2022-04-12T07:57:45Z")

</div>

I’m following along with this vignette to perform K-fold cross validation for a logistic regression model. I’ve included my model code at the end of this post. At one point, the author does this: fit \<- sampling(stanm…

---

## [Correlated posterior sample in logistic model with measurement error in probability scale](https://discourse.mc-stan.org/t/correlated-posterior-sample-in-logistic-model-with-measurement-error-in-probability-scale/26152)

<div class="topic-metadata">

**Author:** [@ckokal](https://discourse.mc-stan.org/u/ckokal)\
**Replies:** 1\
**Last updated:** [January 30, 2022, 11:52pm UTC](https://discourse.mc-stan.org/t/correlated-posterior-sample-in-logistic-model-with-measurement-error-in-probability-scale/26152 "2022-01-30T23:52:16Z")

</div>

Dear Stan community, I am toying with an example of logistic regression with measurement error and I require your assistance. Although the model fits well and returns the expected regression coefficients, I notice that …

---

## [Using bernoulli\_logit\_glm in a hierarchical model](https://discourse.mc-stan.org/t/using-bernoulli-logit-glm-in-a-hierarchical-model/25131)

<div class="topic-metadata">

**Author:** [@aammd](https://discourse.mc-stan.org/u/aammd)\
**Replies:** 3\
**Last updated:** [November 8, 2021, 2:49pm UTC](https://discourse.mc-stan.org/t/using-bernoulli-logit-glm-in-a-hierarchical-model/25131 "2021-11-08T14:49:03Z")

</div>

I’ve been practising the hierarchical logistic regression example from the documentation. I wanted to combine it with profiling in cmdstanr. However I’m getting tripped up with the types of different variables that are i…

---

## [How to obtain odds-ratio for random effects from rstanarm results and visualize them?](https://discourse.mc-stan.org/t/how-to-obtain-odds-ratio-for-random-effects-from-rstanarm-results-and-visualize-them/24383)

<div class="topic-metadata">

**Author:** [@Fatih\_Bozdag](https://discourse.mc-stan.org/u/Fatih_Bozdag)\
**Replies:** 5\
**Last updated:** [September 22, 2021, 8:57pm UTC](https://discourse.mc-stan.org/t/how-to-obtain-odds-ratio-for-random-effects-from-rstanarm-results-and-visualize-them/24383 "2021-09-22T20:57:57Z")

</div>

Greetings all, I’ve been trying to obtain odds ratio for random effects. I’ve used the parameters package to get summary of posterior distribution and ploted the results, however I get fixed effects on the plot. How can…

---

## [Occupancy modeling package with RStan](https://discourse.mc-stan.org/t/occupancy-modeling-package-with-rstan/23892)

<div class="topic-metadata">

**Author:** [@Richard\_Erickson](https://discourse.mc-stan.org/u/Richard_Erickson)\
**Replies:** 0\
**Last updated:** [August 10, 2021, 1:36pm UTC](https://discourse.mc-stan.org/t/occupancy-modeling-package-with-rstan/23892 "2021-08-10T13:36:46Z")

</div>

I’ve completed the provisional release of my Occupancy Model (also known as Occurrence Model for anyone searching the forum) package. The package is on the USGS Git Repository: UMESC / quant-ecology / occStan · GitLab …

---

## [Is it possible to use a latent variable calculated from a fitted regression as the dependent variable in another regression?](https://discourse.mc-stan.org/t/is-it-possible-to-use-a-latent-variable-calculated-from-a-fitted-regression-as-the-dependent-variable-in-another-regression/23615)

<div class="topic-metadata">

**Author:** [@staned](https://discourse.mc-stan.org/u/staned)\
**Replies:** 10\
**Last updated:** [July 23, 2021, 7:42pm UTC](https://discourse.mc-stan.org/t/is-it-possible-to-use-a-latent-variable-calculated-from-a-fitted-regression-as-the-dependent-variable-in-another-regression/23615 "2021-07-23T19:42:51Z")

</div>

Hello, I have a logged linear regression that predicts total muscle “U” from a measurement of length “L” and adipose fat “A”. \\log(U) \\sim \\alpha\_{lu} + \\beta\_{lu1} \\ast \\log(L) + \\beta\_{lu2} \\ast \\log(A). Once fitted…

---

## [Arm::bayesglm how to interpret results?](https://discourse.mc-stan.org/t/arm-bayesglm-how-to-interpret-results/23218)

<div class="topic-metadata">

**Author:** [@HNSKD](https://discourse.mc-stan.org/u/HNSKD)\
**Replies:** 2\
**Last updated:** [July 2, 2021, 11:58pm UTC](https://discourse.mc-stan.org/t/arm-bayesglm-how-to-interpret-results/23218 "2021-07-02T23:58:32Z")

</div>

arm::bayesglm(y ~ x) I am very new to bayesian statistics, and trying to make sense of it. I have run the arm::bayesglm for bayesian logistic regression using the default priors, but I’m so clueless on how to interpret…

---

## [Ordered Logistic Regression Model Issues](https://discourse.mc-stan.org/t/ordered-logistic-regression-model-issues/22871)

<div class="topic-metadata">

**Author:** [@Robin\_Brooker](https://discourse.mc-stan.org/u/Robin_Brooker)\
**Replies:** 2\
**Last updated:** [June 6, 2021, 8:48pm UTC](https://discourse.mc-stan.org/t/ordered-logistic-regression-model-issues/22871 "2021-06-06T20:48:34Z")

</div>

When estimating this ordered logistic regression model, I get the following error message: \[1\] "Error in sampler$call\_sampler(args\_list\[\[i\]\]) : Initialization failed." error occurred during calling the sampler; sampling…

---

## [Vision and visual navigation in animals using Stan](https://discourse.mc-stan.org/t/vision-and-visual-navigation-in-animals-using-stan/22769)

<div class="topic-metadata">

**Author:** [@johnkirwan](https://discourse.mc-stan.org/u/johnkirwan)\
**Replies:** 0\
**Last updated:** [May 29, 2021, 10:33am UTC](https://discourse.mc-stan.org/t/vision-and-visual-navigation-in-animals-using-stan/22769 "2021-05-29T10:33:01Z")

</div>

We have used Stan to show that vision in present in the brittle star, an animal lacking eyes: https://journals.biologists.com/jeb/article/doi/10.1242/jeb.236653/256564/Run-and-hide-visual-performance-in-a-brittle-star h…

---

## [Multinomial Logit: probability of choice of a soccer action](https://discourse.mc-stan.org/t/multinomial-logit-probability-of-choice-of-a-soccer-action/20334)

<div class="topic-metadata">

**Author:** [@Sebastian\_Mena](https://discourse.mc-stan.org/u/Sebastian_Mena)\
**Replies:** 24\
**Last updated:** [March 9, 2021, 6:12pm UTC](https://discourse.mc-stan.org/t/multinomial-logit-probability-of-choice-of-a-soccer-action/20334 "2021-03-09T18:12:41Z")

</div>

Hello, I’d like to do a stan model (in python) to get the probability of an action choice of a soccer game. Specificly, i have 3 kinds of actions: Shots, Pass and Dribblings. Each soccer player “can choose” one of this…

---

## [Why can't I recover measurement error for logistic regression?](https://discourse.mc-stan.org/t/why-cant-i-recover-measurement-error-for-logistic-regression/21167)

<div class="topic-metadata">

**Author:** [@walkerharrison](https://discourse.mc-stan.org/u/walkerharrison)\
**Replies:** 4\
**Last updated:** [March 9, 2021, 1:39am UTC](https://discourse.mc-stan.org/t/why-cant-i-recover-measurement-error-for-logistic-regression/21167 "2021-03-09T01:39:47Z")

</div>

Let’s imagine a scenario where a binary variable is drawn from a vector of probabilities that we can convert to the log-odds scale: library(boot) library(tidyverse) library(rstan) set.seed(0) N \<- 10000 logodds\_true \<-…

---

## [Removing atypical internal lines from the chain convergence graph using a traceplot function](https://discourse.mc-stan.org/t/removing-atypical-internal-lines-from-the-chain-convergence-graph-using-a-traceplot-function/20488)

<div class="topic-metadata">

**Author:** [@brenogab420](https://discourse.mc-stan.org/u/brenogab420)\
**Replies:** 1\
**Last updated:** [February 5, 2021, 4:11pm UTC](https://discourse.mc-stan.org/t/removing-atypical-internal-lines-from-the-chain-convergence-graph-using-a-traceplot-function/20488 "2021-02-05T16:11:57Z")

</div>

I am making the convergence graph of the chains generated using the traceplot function. However, see what unusual lines are appearing on the chart. How would you go about removing them? data: https://drive.google.com/fi…

---

## [Logistic Regression in Stan](https://discourse.mc-stan.org/t/logistic-regression-in-stan/20038)

<div class="topic-metadata">

**Author:** [@blurpig\_43515](https://discourse.mc-stan.org/u/blurpig_43515)\
**Replies:** 2\
**Last updated:** [January 4, 2021, 5:12pm UTC](https://discourse.mc-stan.org/t/logistic-regression-in-stan/20038 "2021-01-04T17:12:11Z")

</div>

Hi everyone! I am attempting to code a logistic regression model on Stan. I have 6 θs from θ1 to θ6. By right, the mean of θ1 is supposed to be 0.1, θ2 is supposed to be 0.2, θ3 is supposed to be 0.3, θ4 is supposed to…

---

## [Error function hnp for residuals stan\_glm](https://discourse.mc-stan.org/t/error-function-hnp-for-residuals-stan-glm/19504)

<div class="topic-metadata">

**Author:** [@brenogab420](https://discourse.mc-stan.org/u/brenogab420)\
**Replies:** 3\
**Last updated:** [November 27, 2020, 8:06pm UTC](https://discourse.mc-stan.org/t/error-function-hnp-for-residuals-stan-glm/19504 "2020-11-27T20:06:45Z")

</div>

I am trying to diagnose the model for a dose-response assay under a Bayesian approach, however, I am not able to graph it to evaluate the residual components of the deviation using the stan\_glm function. The error is bel…

---

## [Getting multivariate Gaussian prior working in a bayesian logistic regression model](https://discourse.mc-stan.org/t/getting-multivariate-gaussian-prior-working-in-a-bayesian-logistic-regression-model/16298)

<div class="topic-metadata">

**Author:** [@expectmax](https://discourse.mc-stan.org/u/expectmax)\
**Replies:** 3\
**Last updated:** [July 1, 2020, 6:08am UTC](https://discourse.mc-stan.org/t/getting-multivariate-gaussian-prior-working-in-a-bayesian-logistic-regression-model/16298 "2020-07-01T06:08:11Z")

</div>

Hi all! I have a Bayesian Logistic Regression Model that runs with univariate Gaussian priors on each element of the parameter vector \\beta. data { int\<lower = 1\> N; int K; matrix\[N,K\] x; int\<lower = 0, upper =…

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