Skip to content

Uniform sampling of finitely-bounded variable in stan 2.10 #1972

@YannickJadoul

Description

@YannickJadoul

Summary:

Using cmdstan 2.10.0, uniform sampling of a bounded variable real<lower=0, upper=1> x; fails to produce a random sample. The exact same code works in cmdstan 2.8.0, cmdstan 2.9.0 and pystan 2.9.0.

Am I going crazy (possible 😉), or did something get broken in 2.10?

Description:

Something seems to be going wrong in version 2.10.0 of (cmd)stan, if I sample the following model:
parameters { real<lower=0, upper=1> x; } model { x ~ uniform(0, 1); }

When I plot a histogram of the generated samples for x (given more than enough iteratations: ./test sample num_samples=1000000 num_warmup=10000), I see the following distribution:
uniform

The same doesn't happen in cmdstan 2.8.0, cmdstan 2.9.0 or pystan 2.9.0, so I am assuming it has got something to do with version 2.10 of stan:

uniform3
Blue is cmdstan 2.8.0, green is 2.9.0, red is 2.10.0. Exactly the same small model, exactly the same parameters passed on the command line.

Reproducible Steps:

parameters { real<lower=0, upper=1> x; } model { x ~ uniform(0, 1); } and compiling with different versions of cmdstan is all it takes to reproduce. (If relevant: my C++ compiler version is g++ (Ubuntu 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609)

Current Version:

v2.10.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions