# Prior Predictive Check From Tutorial

Hello!
I am following the Stan User Guide Tutorial for Prior Predictive Checks, and am running into a sampling issue. My code for the model is copied straight from the guide:

data {
int<lower = 0> N;
vector[N] x;
}

generated quantities {
real alpha = normal_rng(0, 1);
real beta = normal_rng(0, 1);
real y_sim[N] = poisson_log_rng(alpha + beta * x);
}


This is how I am sampling

x <- rnorm(100, mean = 53, sd = 9)

ppc <- stan_model("prior-post-pred-check.stan")
fit <- sampling(ppc,
data = list(N = 100, x = x),
chains = 1, iter = 2000,
algorithm="Fixed_param")



And I am receiving errors such as:

Exception: poisson_log_rng: Log rate parameter[1] is 80.031, but must be less than 20.7944 (in 'string', line 8, column 2 to column 52)
Chain 1: Exception: poisson_log_rng: Log rate parameter[1] is 78.6089, but must be less than 20.7944 (in 'string', line 8, column 2 to column 52)


I have received errors doing similar things for both negative binomial regressions and basic linear regression, so in general I am confused on how these errors happen. Thank you.

Section 13.6.3 of the Stan Functions Reference Manual (link) states that the log rate parameter, \alpha = \log \lambda must be less than 30 \log 2 (or 20.79). If the log of the rate is 80.03 then the rate is on the order of 5.5*10^34, which seems entirely unrealistic (and probably mathematically unstable, hence the restriction to 20.79). Maybe try using the regular poisson_rng function, or scale your priors/fake data appropriately?