stan-dev / stan-dev/stan

Confusing warning for low-sample-size runs

Open
#2,064 2 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

feature interface
Dominant language
C++
Stars
2.8k
Forks
388
Avg merge
2d 17h
Merged PRs (30d)
15

Description

Summary:

When running Stan programs with low sample sizes (under 300 samples,) Stan returns a (confusing/spurious?) warning regarding the warmup.

Description:

When running an analysis with a sample size under 300, the following warning is generated;

WARNING: The initial buffer, adaptation window, and terminal buffer overflow the total number of warmup iterations.
Defaulting to a 15%/75%/10% partition, {List of used valuesfor each}

Reproducible Steps:

In R, run;

library(rstan)
stanmodelcode <- "
data {
int<lower=0> N;
real y[N];
} 

parameters {
real mu;
} 

model {
target += normal_lpdf(mu | 0, 10);
target += normal_lpdf(y  | mu, 1);
} 
"

y = rnorm(20) 
dat = list(N = 20, y = y); 
fit = stan(model_code = stanmodelcode, model_name = "example", 
            data = dat, iter = 290, chains = 3, sample_file = 'norm.csv',
            verbose = TRUE)
Current Output:
SAMPLING FOR MODEL 'example' NOW (CHAIN 1).
WARNING: The initial buffer, adaptation window, and terminal buffer
         overflow the total number of warmup iterations.
         Defaulting to a 15%/75%/10% partition,
           init_buffer = 21
           adapt_window = 110
           term_buffer = 14

Chain 1, Iteration:   1 / 290 [  0%]  (Warmup)
{etc. - Runs fine}
Expected Output:

No warning, or perhaps;

WARNING: The number of warmup iterations is below the recommended amount.
Additional Information

This error message occurs even when you specify the number of the buffers and window to rstan;

fit <- stan(model_code = stanmodelcode, model_name = "example", 
            data = dat, iter = 200, chains = 1, 
            control=list(c(adapt_init_buffer=10, adapt_term_buffer=10, adapt_window=10)),verbose =TRUE) 
Current Version:

v2.12.0

Contributor guide

Open the contributing guide

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.