# rstanarm

**URL:** https://discourse.mc-stan.org/c/interfaces/rstanarm/27.md?page=1

[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

---

## [POLR with Random Effects](https://discourse.mc-stan.org/t/polr-with-random-effects/28590)

<div class="topic-metadata">

**Author:** [@Carlos\_Parada](https://discourse.mc-stan.org/u/Carlos_Parada)\
**Replies:** 0\
**Last updated:** [August 19, 2022, 4:33pm UTC](https://discourse.mc-stan.org/t/polr-with-random-effects/28590 "2022-08-19T16:33:45Z")

</div>

If I try using stan\_polr with random effects: bayes \<- stan\_polr( value ~ 1 | q, long\_table, prior = R2(.5, what="mean"), chains=parallel::detectCores() ) I get an error: Error in dimnames(x) \<- dn : …

---

## [Error while calculating ROPE using bayestestR package in R](https://discourse.mc-stan.org/t/error-while-calculating-rope-using-bayestestr-package-in-r/28535)

<div class="topic-metadata">

**Author:** [@FatemahSakr](https://discourse.mc-stan.org/u/FatemahSakr)\
**Replies:** 0\
**Last updated:** [August 15, 2022, 12:06pm UTC](https://discourse.mc-stan.org/t/error-while-calculating-rope-using-bayestestr-package-in-r/28535 "2022-08-15T12:06:58Z")

</div>

I have a large dataset (83 variable and ~ 45 observations) and I am fitting bayesian glm for each variable in R using rstanarm. All my bayesian models are saved in a large list (my\_lms). Then I try to generate a summary …

---

## [Rstanarm: CRAN vs Development version installation issues](https://discourse.mc-stan.org/t/rstanarm-cran-vs-development-version-installation-issues/14399)

<div class="topic-metadata">

**Author:** [@JFG](https://discourse.mc-stan.org/u/JFG)\
**Replies:** 74\
**Last updated:** [August 11, 2022, 10:40pm UTC](https://discourse.mc-stan.org/t/rstanarm-cran-vs-development-version-installation-issues/14399 "2022-08-11T22:40:48Z")

</div>

I am new to rstan and rstanarm. I have been able to successfully follow: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started to get started. I have installed rstan and rstanarm (Cran) and have been able to su…

---

## [Rstanarm bug?](https://discourse.mc-stan.org/t/rstanarm-bug/28472)

<div class="topic-metadata">

**Author:** [@saja](https://discourse.mc-stan.org/u/saja)\
**Replies:** 0\
**Last updated:** [August 8, 2022, 4:41am UTC](https://discourse.mc-stan.org/t/rstanarm-bug/28472 "2022-08-08T04:41:29Z")

</div>

Short summary of the problem I was running a simple probit regression using rstanarm, but I got the following error message: “Stan model ‘bernoulli’ does not contain samples. Stan model ‘bernoulli’ does not contain samp…

---

## [MCMC sampling in rstanarm and brms is a lot slower than in rstan for my two-level hierarchical model](https://discourse.mc-stan.org/t/mcmc-sampling-in-rstanarm-and-brms-is-a-lot-slower-than-in-rstan-for-my-two-level-hierarchical-model/28414)

<div class="topic-metadata">

**Author:** [@Zhihan\_Yang](https://discourse.mc-stan.org/u/Zhihan_Yang)\
**Replies:** 7\
**Last updated:** [August 5, 2022, 3:19pm UTC](https://discourse.mc-stan.org/t/mcmc-sampling-in-rstanarm-and-brms-is-a-lot-slower-than-in-rstan-for-my-two-level-hierarchical-model/28414 "2022-08-05T15:19:02Z")

</div>

I’m trying to model the following toy dataset as part of my self-study: running.csv (4.2 KB) You can read this data in using this function: get\_normal\_hierarchical\_predictor\_data \<- function(integer\_encode\_groups=F) {…

---

## [A warning message in stan\_clogit](https://discourse.mc-stan.org/t/a-warning-message-in-stan-clogit/28284)

<div class="topic-metadata">

**Author:** [@zhangguoqianggu](https://discourse.mc-stan.org/u/zhangguoqianggu)\
**Replies:** 2\
**Last updated:** [July 22, 2022, 6:11am UTC](https://discourse.mc-stan.org/t/a-warning-message-in-stan-clogit/28284 "2022-07-22T06:11:59Z")

</div>

When running the Bayesian conditional logistic regression model using stan\_clogit, I always got this error message (see below). But it seems that the analysis still went quite well. I don’t understand this error, but it …

---

## [Launch\_shinystan error](https://discourse.mc-stan.org/t/launch-shinystan-error/28232)

<div class="topic-metadata">

**Author:** [@zhangguoqianggu](https://discourse.mc-stan.org/u/zhangguoqianggu)\
**Replies:** 5\
**Last updated:** [July 21, 2022, 3:24pm UTC](https://discourse.mc-stan.org/t/launch-shinystan-error/28232 "2022-07-21T15:24:33Z")

</div>

When I tried to use launch\_shinystan to reproduce a plot (Figure 4) from shinystan in the paper User-friendly Bayesian regression modeling: A tutorial with rstanarm and shinystan, an error message appeared: “project “gg…

---

## [Error installing rstanarm from github](https://discourse.mc-stan.org/t/error-installing-rstanarm-from-github/28138)

<div class="topic-metadata">

**Author:** [@mollymce](https://discourse.mc-stan.org/u/mollymce)\
**Replies:** 0\
**Last updated:** [July 8, 2022, 2:13pm UTC](https://discourse.mc-stan.org/t/error-installing-rstanarm-from-github/28138 "2022-07-08T14:13:55Z")

</div>

It seems like the stan\_surv function is not included in the latest rstanarm binary, so I’m trying to install the feature/survival branch from github. The installation is failing, and I’m not sure what else to try. I’m u…

---

## [Troubles installing the developer version of 'rstanarm' on M1 Apple](https://discourse.mc-stan.org/t/troubles-installing-the-developer-version-of-rstanarm-on-m1-apple/27150)

<div class="topic-metadata">

**Author:** [@thomas\_zelniker](https://discourse.mc-stan.org/u/thomas_zelniker)\
**Replies:** 0\
**Last updated:** [April 14, 2022, 12:44pm UTC](https://discourse.mc-stan.org/t/troubles-installing-the-developer-version-of-rstanarm-on-m1-apple/27150 "2022-04-14T12:44:25Z")

</div>

Hi, I would like to use the stan\_survival function but I have troubles installing the rstanarm developer version. I tried Sys.setenv(MAKEFLAGS = "-j2") Sys.setenv("R\_REMOTES\_NO\_ERRORS\_FROM\_WARNINGS" = "true") remotes:…

---

## [Best way to model reaction-time experiment with a survival approach](https://discourse.mc-stan.org/t/best-way-to-model-reaction-time-experiment-with-a-survival-approach/26044)

<div class="topic-metadata">

**Author:** [@tester](https://discourse.mc-stan.org/u/tester)\
**Replies:** 2\
**Last updated:** [March 25, 2022, 4:53pm UTC](https://discourse.mc-stan.org/t/best-way-to-model-reaction-time-experiment-with-a-survival-approach/26044 "2022-03-25T16:53:25Z")

</div>

I have a data set that contains repeated measures of subjects at many times (frequency consistently at about 100 Hz) that lead to a certain event where the subjects reacted (the “death” in my case, speaking in survival-a…

---

## [Bfmi-low problem with rstanarm after using parameters model\_parameters](https://discourse.mc-stan.org/t/bfmi-low-problem-with-rstanarm-after-using-parameters-model-parameters/26864)

<div class="topic-metadata">

**Author:** [@Fatih\_Bozdag](https://discourse.mc-stan.org/u/Fatih_Bozdag)\
**Replies:** 0\
**Last updated:** [March 18, 2022, 10:37pm UTC](https://discourse.mc-stan.org/t/bfmi-low-problem-with-rstanarm-after-using-parameters-model-parameters/26864 "2022-03-18T22:37:26Z")

</div>

Greetings all, I have a rather strange (may not be strange and it is my inexperiencedness) issue. After sampling via rstamarm, I use parameters package’s model\_parameters to observe results. However, when I re-run the m…

---

## [Error in get\_refmodel and cv\_varsel](https://discourse.mc-stan.org/t/error-in-get-refmodel-and-cv-varsel/26224)

<div class="topic-metadata">

**Author:** [@csilos](https://discourse.mc-stan.org/u/csilos)\
**Replies:** 18\
**Last updated:** [February 10, 2022, 7:47am UTC](https://discourse.mc-stan.org/t/error-in-get-refmodel-and-cv-varsel/26224 "2022-02-10T07:47:59Z")

</div>

Hello, I am currently using rstanarm to run a stan\_lmer model. I am trying to use the library projpred and when I try to use the function “get\_refmodel” and the function “cv\_varsel” and I get the error: “Error in terms.…

---

## [Error related to installing cmdstanr](https://discourse.mc-stan.org/t/error-related-to-installing-cmdstanr/22724)

<div class="topic-metadata">

**Author:** [@mohammed1990](https://discourse.mc-stan.org/u/mohammed1990)\
**Replies:** 3\
**Last updated:** [January 27, 2022, 9:31am UTC](https://discourse.mc-stan.org/t/error-related-to-installing-cmdstanr/22724 "2022-01-27T09:31:18Z")

</div>

Hi there I am trying to install cmdstanr package under R . Note that I reinstalled R itself and R studio and Rtools40, but I always get errors and cmdstanr never works. I truly need help I do not know what else to do . …

---

## [Divergences in RStanArm MRP Vignette](https://discourse.mc-stan.org/t/divergences-in-rstanarm-mrp-vignette/26057)

<div class="topic-metadata">

**Author:** [@Balexanderstats](https://discourse.mc-stan.org/u/Balexanderstats)\
**Replies:** 1\
**Last updated:** [January 22, 2022, 12:56am UTC](https://discourse.mc-stan.org/t/divergences-in-rstanarm-mrp-vignette/26057 "2022-01-22T00:56:14Z")

</div>

I’m doing some experimentation on MRP. I decided to use the MRP vignette as a base. Interestingly upon running it the model as specified has divergences. But in the knitted vignette there were no divergences and I’ve h…

---

## [Converting unstandardized priors for rstanarm function arguments](https://discourse.mc-stan.org/t/converting-unstandardized-priors-for-rstanarm-function-arguments/25868)

<div class="topic-metadata">

**Author:** [@BeniSportSci](https://discourse.mc-stan.org/u/BeniSportSci)\
**Replies:** 2\
**Last updated:** [January 7, 2022, 9:16am UTC](https://discourse.mc-stan.org/t/converting-unstandardized-priors-for-rstanarm-function-arguments/25868 "2022-01-07T09:16:10Z")

</div>

Hi everyone in the Stan community! I’m struggling to wrap my head around the usage of informative priors in rstanarm functions (in a case where I want exceptionally specific prior information to be included). I’m afraid…

---

## [Reparameterization within rstanarm](https://discourse.mc-stan.org/t/reparameterization-within-rstanarm/25770)

<div class="topic-metadata">

**Author:** [@Lawrence\_Hunsicker](https://discourse.mc-stan.org/u/Lawrence_Hunsicker)\
**Replies:** 4\
**Last updated:** [December 28, 2021, 6:28pm UTC](https://discourse.mc-stan.org/t/reparameterization-within-rstanarm/25770 "2021-12-28T18:28:52Z")

</div>

I have run a heirarchical model using stan\_lmer but despite increasing adapt\_delta up to 0.999 I continue to get the same one divergent draw… As suggested, I ran pairs, etc. and indeed I found a funnel. So I read about…

---

## [Rstanarm survival: options for dealing with violated proportional hazards](https://discourse.mc-stan.org/t/rstanarm-survival-options-for-dealing-with-violated-proportional-hazards/21548)

<div class="topic-metadata">

**Author:** [@di4oi4](https://discourse.mc-stan.org/u/di4oi4)\
**Replies:** 11\
**Last updated:** [December 23, 2021, 12:08pm UTC](https://discourse.mc-stan.org/t/rstanarm-survival-options-for-dealing-with-violated-proportional-hazards/21548 "2021-12-23T12:08:52Z")

</div>

I have a relatively large survival data (n \> 10 000), including 5 predictors. Predictors p1 and p2 are continuous, the rest are categorical. Group variable is the one I am interested in, the remaining are just used for a…

---

## [Default prior for probit regression with many predictors fails to sample](https://discourse.mc-stan.org/t/default-prior-for-probit-regression-with-many-predictors-fails-to-sample/23959)

<div class="topic-metadata">

**Author:** [@EdwardJRoss](https://discourse.mc-stan.org/u/EdwardJRoss)\
**Replies:** 3\
**Last updated:** [November 30, 2021, 10:04pm UTC](https://discourse.mc-stan.org/t/default-prior-for-probit-regression-with-many-predictors-fails-to-sample/23959 "2021-11-30T22:04:46Z")

</div>

I’ve been working through Exercise 15.5 of Regression and Other Stories, which asks to take a logit model and convert it to a probit. I found when trying to fit models with more than a few predictors, without setting th…

---

## [Why does stan\_lm ignore a factor level in a model with no intercept?](https://discourse.mc-stan.org/t/why-does-stan-lm-ignore-a-factor-level-in-a-model-with-no-intercept/24877)

<div class="topic-metadata">

**Author:** [@prabinov](https://discourse.mc-stan.org/u/prabinov)\
**Replies:** 2\
**Last updated:** [November 13, 2021, 2:56pm UTC](https://discourse.mc-stan.org/t/why-does-stan-lm-ignore-a-factor-level-in-a-model-with-no-intercept/24877 "2021-11-13T14:56:12Z")

</div>

stan\_lm gives estimates for only two of the three levels below (‘A’ and ‘B’), and ignores ‘C’. Any clues why? library(tidyverse) library(rstanarm) df \<- tribble( ~nm, ~ft, "A", 122.0, "A", 121.0, "B", 120.0, …

---

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

---

## [Stan\_nlmer group specific effects are not being passed to posterior\_predict](https://discourse.mc-stan.org/t/stan-nlmer-group-specific-effects-are-not-being-passed-to-posterior-predict/24056)

<div class="topic-metadata">

**Author:** [@jwdorrough](https://discourse.mc-stan.org/u/jwdorrough)\
**Replies:** 2\
**Last updated:** [September 7, 2021, 3:49am UTC](https://discourse.mc-stan.org/t/stan-nlmer-group-specific-effects-are-not-being-passed-to-posterior-predict/24056 "2021-09-07T03:49:56Z")

</div>

I think I have encountered an underlying error when trying to draw from the posterior predicted distribution of stan\_nlmer models. It appears that the group specific terms are not being passed to posterior\_predict. In …

---

## [Trouble installing rstanarm on Linux](https://discourse.mc-stan.org/t/trouble-installing-rstanarm-on-linux/24060)

<div class="topic-metadata">

**Author:** [@mike-lawrence](https://discourse.mc-stan.org/u/mike-lawrence)\
**Replies:** 1\
**Last updated:** [August 23, 2021, 8:44am UTC](https://discourse.mc-stan.org/t/trouble-installing-rstanarm-on-linux/24060 "2021-08-23T08:44:03Z")

</div>

I’m having trouble installing rstanarm on my Ubuntu 20.04.3 system. I’ve tried both the CRAN version (2.21.1) via install.packages('rstanarm') as well as the dev version via remotes::install\_github('stan-dev/rstanarm') (…

---

## [Pp\_validate() error, how to debug](https://discourse.mc-stan.org/t/pp-validate-error-how-to-debug/23787)

<div class="topic-metadata">

**Author:** [@RMN](https://discourse.mc-stan.org/u/RMN)\
**Replies:** 1\
**Last updated:** [August 11, 2021, 3:34am UTC](https://discourse.mc-stan.org/t/pp-validate-error-how-to-debug/23787 "2021-08-11T03:34:40Z")

</div>

Hi all, I want to to a prior preditive check for my model (stan\_glmer) and came across an error. I tried to reduce runtime by setting nreps to 2 and using a small subsample of my data (n = 1000). I further restricted t…

---

## [Median survival probabilities from stan\_surv fit](https://discourse.mc-stan.org/t/median-survival-probabilities-from-stan-surv-fit/22707)

<div class="topic-metadata">

**Author:** [@jgellar](https://discourse.mc-stan.org/u/jgellar)\
**Replies:** 6\
**Last updated:** [August 10, 2021, 1:22pm UTC](https://discourse.mc-stan.org/t/median-survival-probabilities-from-stan-surv-fit/22707 "2021-08-10T13:22:05Z")

</div>

I have fit a Cox model (with a cluster-specific random intercept) using stan\_surv. Is there an easy way to predict the median survival time for each observation? Note that this is not what is returned by posterior\_survfi…

---

## [Stan\_mvmer with shared parameters for sub-models?](https://discourse.mc-stan.org/t/stan-mvmer-with-shared-parameters-for-sub-models/3873)

<div class="topic-metadata">

**Author:** [@ermeel](https://discourse.mc-stan.org/u/ermeel)\
**Replies:** 6\
**Last updated:** [August 9, 2021, 4:35pm UTC](https://discourse.mc-stan.org/t/stan-mvmer-with-shared-parameters-for-sub-models/3873 "2021-08-09T16:35:58Z")

</div>

I was wondering whether there is an option in stan\_mvmer or another multivariate GLM supporting method in rstanarm that allows for shared parameters between sub-models, e.g. one could have a standard regression model and…

---

## [Help regarding handling of NA in posterior\_predict](https://discourse.mc-stan.org/t/help-regarding-handling-of-na-in-posterior-predict/20031)

<div class="topic-metadata">

**Author:** [@amir1m](https://discourse.mc-stan.org/u/amir1m)\
**Replies:** 2\
**Last updated:** [June 25, 2021, 11:54pm UTC](https://discourse.mc-stan.org/t/help-regarding-handling-of-na-in-posterior-predict/20031 "2021-06-25T23:54:42Z")

</div>

I have fit a model using rstanarm::stan\_glm. However, while running posterior\_predict I am getting error about the NAs in the data. It looks like there is no support for handling NAs yet. Is there any workaround? Follow…

---

## [Rstanarm survival - random effects](https://discourse.mc-stan.org/t/rstanarm-survival-random-effects/22662)

<div class="topic-metadata">

**Author:** [@sbhuey](https://discourse.mc-stan.org/u/sbhuey)\
**Replies:** 5\
**Last updated:** [June 13, 2021, 3:40am UTC](https://discourse.mc-stan.org/t/rstanarm-survival-random-effects/22662 "2021-06-13T03:40:52Z")

</div>

The survival branch of rstanarm is excellent and the Brilleman et al paper has really accelerated my ability and understanding of survival models, so thanks to all who worked so hard on this branch. My survival model is…

---

## [Calculating hazard ratios and interpreting differences in survival and between a multi-level covariate from rstanarm::stan\_surv](https://discourse.mc-stan.org/t/calculating-hazard-ratios-and-interpreting-differences-in-survival-and-between-a-multi-level-covariate-from-rstanarm-stan-surv/22542)

<div class="topic-metadata">

**Author:** [@padpadpadpad](https://discourse.mc-stan.org/u/padpadpadpad)\
**Replies:** 3\
**Last updated:** [May 25, 2021, 8:27am UTC](https://discourse.mc-stan.org/t/calculating-hazard-ratios-and-interpreting-differences-in-survival-and-between-a-multi-level-covariate-from-rstanarm-stan-surv/22542 "2021-05-25T08:27:44Z")

</div>

Hi Stan forum This is my first time posting on here and it seems a wonderful and friendly resource! Sorry for the verbose post I opted for full code reproducibility above brevity in places! I am fitting a proportional-…

---

## [Rstanarm: extracting variance components](https://discourse.mc-stan.org/t/rstanarm-extracting-variance-components/4409)

<div class="topic-metadata">

**Author:** [@dom\_roche](https://discourse.mc-stan.org/u/dom_roche)\
**Replies:** 14\
**Last updated:** [May 18, 2021, 4:15pm UTC](https://discourse.mc-stan.org/t/rstanarm-extracting-variance-components/4409 "2021-05-18T16:15:28Z")

</div>

Operating System: Windows 7 rstanarm Version: 2.17.4 I’m an ecologist and often conduct repeated measures experiments on animals to look at individual differences in behaviour and metabolism. I’m keen to start using r…

---

## [Location of samples behind the coefficients](https://discourse.mc-stan.org/t/location-of-samples-behind-the-coefficients/22372)

<div class="topic-metadata">

**Author:** [@sgutreuter](https://discourse.mc-stan.org/u/sgutreuter)\
**Replies:** 4\
**Last updated:** [May 8, 2021, 11:06pm UTC](https://discourse.mc-stan.org/t/location-of-samples-behind-the-coefficients/22372 "2021-05-08T23:06:18Z")

</div>

After fitting a negative binomial model containing two factor predictors and their interaction, I want to compute posterior summaries of reparameterized coefficients which give the relative risks for each combination of …

[Previous page](https://discourse.mc-stan.org/c/interfaces/rstanarm/27.md)

[Next page](https://discourse.mc-stan.org/c/interfaces/rstanarm/27.md?page=2)
