Hello Stan users,

I know that generating random numbers in transformed parameters are prohibited in Stan, and somehow it will not be a full Bayesian model anymore because of ‘restricting flow of information’. But I do not see what is wrong with the following approach.

parameters{

vector[n] mu;

vector[m] noise;

}

transformed parameters{

vector[m] rv;

vector[m] rv_mean;

vector[m] rv_var;

rv_mean = f(mu);

rv_var = f(mu);

rv = rv_mean + noise;

}

model{

noise ~ normal(0, sqrt(rv_var));

data ~ poisson_log(f(rv));

}

I do not have a fixed model yet, hence the abstract code. f() are some function, and m>n.

My question is:

- would the variable rv then follow normal(rv_mean, sqrt(rv_var))?
- would data inform parameter mu?
- Is the evaluation equivalent to putting rv ~ normal(rv_mean, sqrt(rv_var)); in the model block directly?

Thanks. Craig