Example programs in help for rstan::stan

This is a real newbie question. I am returning to learning Stan in R. The sample code in the help for the rstan::stan function provides two “examples,” but I simply don’t understand the first example:

parameters {
real y[2];
}
model {
y[1] ~ normal(0, 1);
y[2] ~ double_exponential(0, 2);
}

This code compiles just fine and appears to estimate the mean and std of an rnorm(0,1) distribution and the similar for a double_exponential distribution. But there is no data block. Where and how are the “sample” data defined? Is there a set of default length data of the appropriate distribution supplied by the two distribution calls?
I.m sorry to be so dense. Thanks to any that can explain this to me.
Larry Hunsicker

So that model would be an example of a model that “samples from the prior”.

1 Like

OK. This is running the prior with a null likelihood. You just get the prior back. So you get back the requested number of iterations draws from the prior(s).

For others that had this question, a reference in the Stan User’s Guide is:

26.4.1 Coding prior predictive checks in Stan

Thanks, Mike.

1 Like