# Rstanarm pp\_validate bug?

**URL:** <https://discourse.mc-stan.org/t/rstanarm-pp-validate-bug/8637>\
**Category:** rstanarm\
**Tags:** bug\
**Created:** [April 27, 2019, 1:44am UTC](https://discourse.mc-stan.org/t/rstanarm-pp-validate-bug/8637 "2019-04-27T01:44:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nlpacestan](https://avatars.discourse-cdn.com/v4/letter/n/71e660/32.png) [@nlpacestan](https://discourse.mc-stan.org/u/nlpacestan)\
**Post date:** [April 27, 2019, 1:44am UTC](https://discourse.mc-stan.org/t/rstanarm-pp-validate-bug/8637/1 "2019-04-27T01:44:06Z")

</div>

I have estimated a stan\_lm model.

I use RStudio.

Model Info:

function: stan\_lm  
family: gaussian [identity]  
formula: log(StandardizedOME) ~ Age + AnesthesiaDuration + AnesthesiaTechniqueBlock + AnesthesiaTechniqueGeneral + AnesthesiaTechniqueNeuraxial + o.ASAClass + EmergencyStatusYN + t.Race + Sex + REMI + o.NonOpioidAnalgesicsCount + o.AIM1Year + CPTBucket + MPOGInstitutionID  
algorithm: sampling  
priors: see help(‘prior\_summary’)  
sample: 16000 (posterior sample size)  
observations: 1104358  
predictors:

## Priors for model ‘StandardizedOME.stan\_lm.3’

Intercept (after predictors centered)  
~ flat

## Coefficients ~ R2(location = 0.3, what = ‘mode’)

I run with iter = 8000 to reach n\_eff \> 1000 for the log\_posterior.

The mixing traces seem ok.

The pp\_check plot is reasonable.

I called the pp\_validate function for this model.

I use the default arguments for nreps and seed.

An error message appears within a minute.

“RStudio RSession has stopped working”

I must close and reboot the RStudio session.

This is reproducible (5 times).

I am still new at doing stanarm.

Any suggestions?

Nathan

Please also provide the following information in addition to your question:

- Operating System: Windows
- rstanarm Version: rstan\_2.18.2

> sessionInfo()  
> R version 3.5.3 (2019-03-11)  
> Platform: x86\_64-w64-mingw32/x64 (64-bit)  
> Running under: Windows Server \>= 2012 x64 (build 9200)

Matrix products: default

locale:  
[1] LC\_COLLATE=English\_United States.1252 LC\_CTYPE=English\_United States.1252  
[3] LC\_MONETARY=English\_United States.1252 LC\_NUMERIC=C  
[5] LC\_TIME=English\_United States.1252

attached base packages:  
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):  
[1] compiler\_3.5.3 tools\_3.5.3 yaml\_2.2.0

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [April 27, 2019, 2:16am UTC](https://discourse.mc-stan.org/t/rstanarm-pp-validate-bug/8637/2 "2019-04-27T02:16:46Z")

</div>

I think you ran out of RAM. With over a million observations and 16000 posterior draws that can happen. I don’t think you need so many draws. But the `pp_validate` function does not do Simulation Based Callibration correctly anyway, so I would not worry about it.

---

<div class="post-metadata">

**Author:** ![nlpacestan](https://avatars.discourse-cdn.com/v4/letter/n/71e660/32.png) [@nlpacestan](https://discourse.mc-stan.org/u/nlpacestan)\
**Post date:** [April 27, 2019, 5:36pm UTC](https://discourse.mc-stan.org/t/rstanarm-pp-validate-bug/8637/3 "2019-04-27T17:36:43Z")

</div>

Thanks for the comment about pp\_validate.

Concerning the number of draws, I was following the recommendation to keep n\_eff \> 1000.

Is that rule-of-thumb more flexible?

Nathan

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [April 27, 2019, 5:49pm UTC](https://discourse.mc-stan.org/t/rstanarm-pp-validate-bug/8637/4 "2019-04-27T17:49:55Z")

</div>

I don’t think you should be that concerned with the effective sample size of `lp__` if that is what you are asking. The current recommendation is to have at least 100 effective samples per chain using the bulk ESS and tail ESS functions (which are not yet available in the rstan you are using).
