stan-dev / stan-dev/rstan

warning of chains not mixing, when there is a correlation which is NA

Open
#749 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

Summary:

I get a false alarm of chains not mixing, because an Rhat is NA, which should be fine. It's related to https://github.com/paul-buerkner/brms/issues/864

Reproducible Steps:

I was a bit lazy and generated the code with brms.

library(brms)
library(rstan)
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores())
data <- data.frame(x= rnorm(1000), y = rnorm(1000), z = rnorm(1000), g =rep(1:10,100))

code <- make_stancode(y ~ x + (x|g), data= data, control = list(adapt_delta =.9)) 
ls_data <- make_standata(y ~ x + (x|g), data= data, control = list(adapt_delta =.9)) 
f <- stan(model_code = code,data =ls_data)
Current Output:
Warning messages:
1: The largest R-hat is NA, indicating chains have not mixed.
Running the chains for more iterations may help. See
http://mc-stan.org/misc/warnings.html#r-hat 
2: Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
Running the chains for more iterations may help. See
http://mc-stan.org/misc/warnings.html#bulk-ess 
3: Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
Running the chains for more iterations may help. See
http://mc-stan.org/misc/warnings.html#tail-ess 
Expected Output:

No warning

RStan Version:

2.19.3

R Version:

R version 3.6.3 (2020-02-29)

Operating System:

Ubuntu 18.04

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied RStan 2.19.3 reproduction on the stated R and Ubuntu versions, then trace where the R-hat warning is generated when its largest value is NA. Check related issue #864 for context. Done means this case no longer emits the false chain-mixing warning while genuine diagnostics remain reported.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.