I want to extract z
in the trasformed data block from the stanfit object f
. Is it possible?
library(rstan)
m <- stan_model(model_code = '
data{real x;}
transformed data{real z; z = chi_square_rng(x); }
parameters {real y;}
model {y ~ normal(z,1);}')
f <- sampling(m, data=list(x=1), iter = 100)