Also your simulation in R does not match the simulation in Stan. Specifying a bound in the generated quantities
block does not ensure that you are sampling from a truncated normal distribution. I’m looking at real<lower=0> inv_phi;
. Take a look at this thread on why and how to write the truncated normal in the generated quantities block Generated quantites block - #4 by bgoodri.
This still doesn’t explain the 0.13 though.