# rstanarm

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

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

---

## [Specifying different priors for different coefficients in RStanARM?](https://discourse.mc-stan.org/t/specifying-different-priors-for-different-coefficients-in-rstanarm/13022)

<div class="topic-metadata">

**Author:** [@blakeobeans](https://discourse.mc-stan.org/u/blakeobeans)\
**Replies:** 6\
**Last updated:** [April 2, 2020, 3:41pm UTC](https://discourse.mc-stan.org/t/specifying-different-priors-for-different-coefficients-in-rstanarm/13022 "2020-04-02T15:41:25Z")

</div>

Is there a way to specify different priors in RStanARM? In Stan, you can do x1 ~ normal(0,1), x2 ~ normal(0,3), etc… I do not see a way to do that in RStanARM- only prior, prior\_intercept and prior\_aux.

---

## [How to use a Covariance matrix prior in Bayesian ordinal regression model?](https://discourse.mc-stan.org/t/how-to-use-a-covariance-matrix-prior-in-bayesian-ordinal-regression-model/13716)

<div class="topic-metadata">

**Author:** [@yousifi](https://discourse.mc-stan.org/u/yousifi)\
**Replies:** 3\
**Last updated:** [March 18, 2020, 3:39am UTC](https://discourse.mc-stan.org/t/how-to-use-a-covariance-matrix-prior-in-bayesian-ordinal-regression-model/13716 "2020-03-18T03:39:52Z")

</div>

fit \<- stan\_polr (FWS1 ~ Ethnic1 + Fam1 + Eco1+ Health1 + Safety1 + Community1 + Religios1 + Housing1, data = as.data.frame (BayesOrdinal1), method = “logistic”, prior = lkj(regularization, scale, df), prior\_counts = dir…

---

## [Rstanarm - extract fixef/ranef posterior as in arm::sim() or brms::ranef(..., summary = FALSE)](https://discourse.mc-stan.org/t/rstanarm-extract-fixef-ranef-posterior-as-in-arm-sim-or-brms-ranef-summary-false/13690)

<div class="topic-metadata">

**Author:** [@saschagobel](https://discourse.mc-stan.org/u/saschagobel)\
**Replies:** 2\
**Last updated:** [March 16, 2020, 7:52pm UTC](https://discourse.mc-stan.org/t/rstanarm-extract-fixef-ranef-posterior-as-in-arm-sim-or-brms-ranef-summary-false/13690 "2020-03-16T19:52:10Z")

</div>

Hi, Is there a way to separately extract population-level and group-levels estimates from multilevel models fitted via rstanarm with the same structure as returned by using arm::sim() on lme4 models or brms::ranef(..., …

---

## [Error in check\_stanfit(stanfit)](https://discourse.mc-stan.org/t/error-in-check-stanfit-stanfit/13588)

<div class="topic-metadata">

**Author:** [@asael\_am](https://discourse.mc-stan.org/u/asael_am)\
**Replies:** 4\
**Last updated:** [March 9, 2020, 1:57am UTC](https://discourse.mc-stan.org/t/error-in-check-stanfit-stanfit/13588 "2020-03-09T01:57:44Z")

</div>

Please also provide the following information in addition to your question: Operating System: Windows rstanarm Version: 2.19.3 Hi everyone; I ran a stal\_glm example for a poisson regression that I found here: Estimat…

---

## [Empirical Bayesian ordinal regression model](https://discourse.mc-stan.org/t/empirical-bayesian-ordinal-regression-model/13511)

<div class="topic-metadata">

**Author:** [@yousifi](https://discourse.mc-stan.org/u/yousifi)\
**Replies:** 11\
**Last updated:** [March 7, 2020, 4:28pm UTC](https://discourse.mc-stan.org/t/empirical-bayesian-ordinal-regression-model/13511 "2020-03-07T16:28:31Z")

</div>

fit ← stan\_polr (FWS1 ~ Ethnic1 + Fam1 + Eco1+ Health1 + Safety1 + Community1 + Religios1 + Housing1, data = as.data.frame (BayesOrdinal1), method = “logistic”, prior = R2(0.2, “mean”), prior\_counts = dirichlet(1)…

---

## [Bayesian ordinal regression model (Empirical Bayes ordinal regression model)](https://discourse.mc-stan.org/t/bayesian-ordinal-regression-model-empirical-bayes-ordinal-regression-model/13186)

<div class="topic-metadata">

**Author:** [@yousifi](https://discourse.mc-stan.org/u/yousifi)\
**Replies:** 13\
**Last updated:** [March 3, 2020, 11:06am UTC](https://discourse.mc-stan.org/t/bayesian-ordinal-regression-model-empirical-bayes-ordinal-regression-model/13186 "2020-03-03T11:06:32Z")

</div>

Dear all, I have the 2 sets of data of Family Well-being Survey. The first data is survey data in year 2011, while the second is survey data in year 2016. The list of variables involved in this study are : Dependent…

---

## [Including group-level covariates in multi-level model](https://discourse.mc-stan.org/t/including-group-level-covariates-in-multi-level-model/13453)

<div class="topic-metadata">

**Author:** [@blakeobeans](https://discourse.mc-stan.org/u/blakeobeans)\
**Replies:** 1\
**Last updated:** [March 2, 2020, 6:56pm UTC](https://discourse.mc-stan.org/t/including-group-level-covariates-in-multi-level-model/13453 "2020-03-02T18:56:52Z")

</div>

Hi, just a quick coding question related to RStanARM and multi-level models. Do I need to do differentiate between group- and individual-level covariates? For example, with the infamous Radon study, could I include both …

---

## [How correlation is computed in rstanarm output](https://discourse.mc-stan.org/t/how-correlation-is-computed-in-rstanarm-output/13268)

<div class="topic-metadata">

**Author:** [@dbernett](https://discourse.mc-stan.org/u/dbernett)\
**Replies:** 1\
**Last updated:** [February 24, 2020, 7:05pm UTC](https://discourse.mc-stan.org/t/how-correlation-is-computed-in-rstanarm-output/13268 "2020-02-24T19:05:59Z")

</div>

I have a question about how the correlation between varying slopes and intercepts in computed in the output that is displayed when you call print() on your fitted model object in rstanarm. The posterior samples matrix d…

---

## [New user struggling to get rstanarm running](https://discourse.mc-stan.org/t/new-user-struggling-to-get-rstanarm-running/13151)

<div class="topic-metadata">

**Author:** [@kcrum](https://discourse.mc-stan.org/u/kcrum)\
**Replies:** 4\
**Last updated:** [February 19, 2020, 2:50am UTC](https://discourse.mc-stan.org/t/new-user-struggling-to-get-rstanarm-running/13151 "2020-02-19T02:50:19Z")

</div>

Hello! I’m new to rstanarm, and even simple calls to stan\_glm are failing with somewhat cryptic errors. For example, if I call the first example in the stan\_glm vignette: mtcars$mpg10 \<- mtcars$mpg / 10 fit \<- stan\_glm(…

---

## [Stan\_gamm4 with random effect throws c++ exception and does not contain samples](https://discourse.mc-stan.org/t/stan-gamm4-with-random-effect-throws-c-exception-and-does-not-contain-samples/13096)

<div class="topic-metadata">

**Author:** [@peopletrees](https://discourse.mc-stan.org/u/peopletrees)\
**Replies:** 7\
**Last updated:** [February 13, 2020, 2:08am UTC](https://discourse.mc-stan.org/t/stan-gamm4-with-random-effect-throws-c-exception-and-does-not-contain-samples/13096 "2020-02-13T02:08:52Z")

</div>

Hey all, When I add a varying intercept to stan\_gamm4, suddenly "Error in sampler$call\_sampler(args\_list\[\[i\]\]) : " \[2\] " c++ exception (unknown reason)" and Stan model 'continuous' does not contain samples. Here’s som…

---

## [Rstanarm excludes level of a factor](https://discourse.mc-stan.org/t/rstanarm-excludes-level-of-a-factor/12879)

<div class="topic-metadata">

**Author:** [@blakeobeans](https://discourse.mc-stan.org/u/blakeobeans)\
**Replies:** 1\
**Last updated:** [January 30, 2020, 6:18am UTC](https://discourse.mc-stan.org/t/rstanarm-excludes-level-of-a-factor/12879 "2020-01-30T06:18:29Z")

</div>

Hi, quick question, hope a reprex is not required. When I run a regression using rstanarm, one level of a given factor predictor is excluded, just like it would be for lm(). Up until this point, I’ve been using rstan whi…

---

## [How to run stan:glmer in parallel on windows?](https://discourse.mc-stan.org/t/how-to-run-stan-glmer-in-parallel-on-windows/12665)

<div class="topic-metadata">

**Author:** [@johnnydubois13](https://discourse.mc-stan.org/u/johnnydubois13)\
**Replies:** 4\
**Last updated:** [January 18, 2020, 2:09am UTC](https://discourse.mc-stan.org/t/how-to-run-stan-glmer-in-parallel-on-windows/12665 "2020-01-18T02:09:14Z")

</div>

Operating System: Windows 10 rstanarm Version: 2.19.2 2019-10-03 \[1\] CRAN (R 3.6.1) Hi all, I’m struggling to find any info on how to run a glmer model in parallel on windows. It looks like Macs have the simple solut…

---

## [Shinystan with stan\_jm model](https://discourse.mc-stan.org/t/shinystan-with-stan-jm-model/12461)

<div class="topic-metadata">

**Author:** [@Lawrence\_Hunsicker](https://discourse.mc-stan.org/u/Lawrence_Hunsicker)\
**Replies:** 12\
**Last updated:** [January 6, 2020, 8:57pm UTC](https://discourse.mc-stan.org/t/shinystan-with-stan-jm-model/12461 "2020-01-06T20:57:20Z")

</div>

Please also provide the following information in addition to your question: Operating System: Windows 10 64 bit up-to-date rstanarm Version: 2.19.2 I have run a stan\_jm model that runs forever and ends with multiple…

---

## [Is there an efficient way to extract a coefficient table from a stan\_jm table?](https://discourse.mc-stan.org/t/is-there-an-efficient-way-to-extract-a-coefficient-table-from-a-stan-jm-table/12499)

<div class="topic-metadata">

**Author:** [@Lawrence\_Hunsicker](https://discourse.mc-stan.org/u/Lawrence_Hunsicker)\
**Replies:** 1\
**Last updated:** [January 4, 2020, 10:24pm UTC](https://discourse.mc-stan.org/t/is-there-an-efficient-way-to-extract-a-coefficient-table-from-a-stan-jm-table/12499 "2020-01-04T22:24:41Z")

</div>

The summary method for a stan\_jm model prints out a nice table of the coefficients for the longitudinal and event models, with means, sd, and quantiles. Is there a way to extract these tables as a data.frame from either…

---

## [Stan\_glmer with family=mgcv::betar(link="logit") posterior\_linpred error](https://discourse.mc-stan.org/t/stan-glmer-with-family-mgcv-betar-link-logit-posterior-linpred-error/12200)

<div class="topic-metadata">

**Author:** [@landerso](https://discourse.mc-stan.org/u/landerso)\
**Replies:** 10\
**Last updated:** [December 26, 2019, 3:39pm UTC](https://discourse.mc-stan.org/t/stan-glmer-with-family-mgcv-betar-link-logit-posterior-linpred-error/12200 "2019-12-26T15:39:25Z")

</div>

Please also provide the following information in addition to your question: Operating System: Windows 10 rstanarm Version: 2.19.2 I updated R and rstanarm today and now I am running into an error with posterior\_linpre…

---

## [Trying to specify intercept only model](https://discourse.mc-stan.org/t/trying-to-specify-intercept-only-model/12390)

<div class="topic-metadata">

**Author:** [@Longshot408](https://discourse.mc-stan.org/u/Longshot408)\
**Replies:** 14\
**Last updated:** [December 22, 2019, 8:10am UTC](https://discourse.mc-stan.org/t/trying-to-specify-intercept-only-model/12390 "2019-12-22T08:10:01Z")

</div>

Hello all, Very simple question on creating an intercept-only model: How do I do it? I would have thought my code below would work, but it is returning an error. \> InterceptModel \<- stan\_glm( + Accept\_Reject ~ 1…

---

## [Bulk and tail ESS with rstanarm](https://discourse.mc-stan.org/t/bulk-and-tail-ess-with-rstanarm/12162)

<div class="topic-metadata">

**Author:** [@b\_j13](https://discourse.mc-stan.org/u/b_j13)\
**Replies:** 2\
**Last updated:** [December 3, 2019, 11:39am UTC](https://discourse.mc-stan.org/t/bulk-and-tail-ess-with-rstanarm/12162 "2019-12-03T11:39:25Z")

</div>

I think this will be a straightforward question - is it possible to easily extract bulk and tail effective sample sizes from rstanarm models (stanreg objects) in a similar way to using the monitor function with a stanfit…

---

## [Custom hierarchical logistic reg has larger std errors than stan\_glmer results](https://discourse.mc-stan.org/t/custom-hierarchical-logistic-reg-has-larger-std-errors-than-stan-glmer-results/11894)

<div class="topic-metadata">

**Author:** [@prockenschaub](https://discourse.mc-stan.org/u/prockenschaub)\
**Replies:** 3\
**Last updated:** [November 15, 2019, 9:31am UTC](https://discourse.mc-stan.org/t/custom-hierarchical-logistic-reg-has-larger-std-errors-than-stan-glmer-results/11894 "2019-11-15T09:31:51Z")

</div>

I recently had a hierarchical logistic regression problem that I solved with rstanarm’s stan\_glmer. In simplified form, the problem contains a random intercept, a random slope for a numerical variable and random slopes f…

---

## [Rstanarm(optimize = TRUE) diagnostics](https://discourse.mc-stan.org/t/rstanarm-optimize-true-diagnostics/11921)

<div class="topic-metadata">

**Author:** [@lauren](https://discourse.mc-stan.org/u/lauren)\
**Replies:** 2\
**Last updated:** [November 15, 2019, 3:13am UTC](https://discourse.mc-stan.org/t/rstanarm-optimize-true-diagnostics/11921 "2019-11-15T03:13:11Z")

</div>

@Xinyi\_Chen, @andrewgelman and I are working on updating the MI package from a backend of bayesglm to a backend of rstanarm with the “optimize” setting. Are there any diagnostics that we ought to be looking at?

---

## [Survival predictions by categorical covariates in stan\_jm](https://discourse.mc-stan.org/t/survival-predictions-by-categorical-covariates-in-stan-jm/9516)

<div class="topic-metadata">

**Author:** [@ericnovik](https://discourse.mc-stan.org/u/ericnovik)\
**Replies:** 6\
**Last updated:** [November 14, 2019, 12:49pm UTC](https://discourse.mc-stan.org/t/survival-predictions-by-categorical-covariates-in-stan-jm/9516 "2019-11-14T12:49:09Z")

</div>

posterior\_survfit as far as I understand generates survival predictions for each subject. In the current implementation of stan\_jm, is there a way to predict for a subgroup, like treatment, sex, etc.? @sambrilleman Op…

---

## [Rstanarm package installation failure](https://discourse.mc-stan.org/t/rstanarm-package-installation-failure/11603)

<div class="topic-metadata">

**Author:** [@ricc7059](https://discourse.mc-stan.org/u/ricc7059)\
**Replies:** 3\
**Last updated:** [October 27, 2019, 3:29pm UTC](https://discourse.mc-stan.org/t/rstanarm-package-installation-failure/11603 "2019-10-27T15:29:04Z")

</div>

I am using RStudio running on an Amazon Linux server in EC2. My colleagues are currently using RStudio running on the same server. They have successfully installed and have been utilizing the rstanarm package. I have …

---

## [Using stan\_glm to estimate a proportion](https://discourse.mc-stan.org/t/using-stan-glm-to-estimate-a-proportion/11339)

<div class="topic-metadata">

**Author:** [@Clay\_Ford](https://discourse.mc-stan.org/u/Clay_Ford)\
**Replies:** 8\
**Last updated:** [October 10, 2019, 8:12pm UTC](https://discourse.mc-stan.org/t/using-stan-glm-to-estimate-a-proportion/11339 "2019-10-10T20:12:28Z")

</div>

Hello. I’ve been teaching myself Bayesian modeling and trying to learn new approaches to solving old problems. For a super basic toy example, let’s say I wanted to estimate the proportion of people who floss at a univer…

---

## [Prior on R2](https://discourse.mc-stan.org/t/prior-on-r2/8291)

<div class="topic-metadata">

**Author:** [@ermeel](https://discourse.mc-stan.org/u/ermeel)\
**Replies:** 7\
**Last updated:** [September 18, 2019, 3:12am UTC](https://discourse.mc-stan.org/t/prior-on-r2/8291 "2019-09-18T03:12:53Z")

</div>

Hi Stanimals, I am trying to follow the logic and derivation behind the idea to put a prior on R^2 for linear regression models. I am trying to write a step by step derivation to fully comprehend it. I have to admit th…

---

## [Issue using posterior\_vs\_prior with Poisson or Neg binomial models](https://discourse.mc-stan.org/t/issue-using-posterior-vs-prior-with-poisson-or-neg-binomial-models/10599)

<div class="topic-metadata">

**Author:** [@Rachel](https://discourse.mc-stan.org/u/Rachel)\
**Replies:** 11\
**Last updated:** [September 14, 2019, 12:02am UTC](https://discourse.mc-stan.org/t/issue-using-posterior-vs-prior-with-poisson-or-neg-binomial-models/10599 "2019-09-14T00:02:51Z")

</div>

Please also provide the following information in addition to your question: Operating System: macOS Mojave 10.14.6 rstanarm Version: 2.18.2 First, thank you to the developers of rstanarm, it’s such a user-friendly way…

---

## [Setting prior on Sigma for stan\_glmer](https://discourse.mc-stan.org/t/setting-prior-on-sigma-for-stan-glmer/10973)

<div class="topic-metadata">

**Author:** [@mike-lawrence](https://discourse.mc-stan.org/u/mike-lawrence)\
**Replies:** 3\
**Last updated:** [September 13, 2019, 4:27pm UTC](https://discourse.mc-stan.org/t/setting-prior-on-sigma-for-stan-glmer/10973 "2019-09-13T16:27:31Z")

</div>

I’m using rstanarm version 2.18.2 to do inference on a hierarchical binomial model. I have some non-default priors (using info from previous experiments), so I run it as: fit = stan\_glmer( data = a , family = binomial…

---

## [Rstanarm/brms/lme4 grouping term question](https://discourse.mc-stan.org/t/rstanarm-brms-lme4-grouping-term-question/10966)

<div class="topic-metadata">

**Author:** [@bbbales2](https://discourse.mc-stan.org/u/bbbales2)\
**Replies:** 1\
**Last updated:** [September 13, 2019, 3:53pm UTC](https://discourse.mc-stan.org/t/rstanarm-brms-lme4-grouping-term-question/10966 "2019-09-13T15:53:22Z")

</div>

If I had multiple groupings of data (like age and state for a bunch of people polled), is there an advantage to saying: (1 | age) + (1 | state) + (1 | state:age) vs. (1 | age) + (1 | state:age) Seems like you’d want …

---

## [Interpreting output from a stan\_mvmer](https://discourse.mc-stan.org/t/interpreting-output-from-a-stan-mvmer/9849)

<div class="topic-metadata">

**Author:** [@CYGUBICKO](https://discourse.mc-stan.org/u/CYGUBICKO)\
**Replies:** 2\
**Last updated:** [July 25, 2019, 6:49am UTC](https://discourse.mc-stan.org/t/interpreting-output-from-a-stan-mvmer/9849 "2019-07-25T06:49:45Z")

</div>

I am fitting Bayesian multivariate generalized linear models with correlated group-specific terms via Stan to model the binary outcomes for three outcomes; y1, y1 and y3 with a single predictor. In addition I have two gr…

---

## [Correctly setting mc.cores for rstanarm models](https://discourse.mc-stan.org/t/correctly-setting-mc-cores-for-rstanarm-models/861)

<div class="topic-metadata">

**Author:** [@ShanZhengYang](https://discourse.mc-stan.org/u/ShanZhengYang)\
**Replies:** 8\
**Last updated:** [June 20, 2019, 5:04pm UTC](https://discourse.mc-stan.org/t/correctly-setting-mc-cores-for-rstanarm-models/861 "2019-06-20T17:04:26Z")

</div>

I’m running a stan\_glm() model via rstanarm on a multi-core server with +150 cores and +1 TB of RAM. It’s not clear to me that the number of cores I set is correct. Let’s say I instantiate and run a Poisson GLM model wi…

---

## [Additive random effect models with large data sets](https://discourse.mc-stan.org/t/additive-random-effect-models-with-large-data-sets/8868)

<div class="topic-metadata">

**Author:** [@David\_Westergaard](https://discourse.mc-stan.org/u/David_Westergaard)\
**Replies:** 25\
**Last updated:** [June 15, 2019, 1:46pm UTC](https://discourse.mc-stan.org/t/additive-random-effect-models-with-large-data-sets/8868 "2019-06-15T13:46:19Z")

</div>

Operating System: CentOS rstanarm Version: 2.15.3 Hi, I am trying to fit a Stan model on a rather large data set with ~3 million observations. The model itself is relatively simple, with one smoothed variable, three b…

---

## [Stan\_glmer (probit) Error in new\_CppObject\_xp](https://discourse.mc-stan.org/t/stan-glmer-probit-error-in-new-cppobject-xp/9206)

<div class="topic-metadata">

**Author:** [@merc](https://discourse.mc-stan.org/u/merc)\
**Replies:** 2\
**Last updated:** [June 11, 2019, 7:09pm UTC](https://discourse.mc-stan.org/t/stan-glmer-probit-error-in-new-cppobject-xp/9206 "2019-06-11T19:09:00Z")

</div>

Hello, I am new to Stan and rstanarm and would like to fit a mixed-effects probit model using the stan\_glmer function in the rstanarm library. The example data set can be constructed using the following: data \<- data.f…

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

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