I have a stanfit
object called fit
returned by rstan::stan(...)
to infer a parameter theta
. I can now analyse theta
using e.g. rstan::summary(fit, pars="theta")
.
I later realised that I am more interested in inference about the square of theta
. I should have included a transformed parameters
block in the STAN model to include theta_squared
as a parameter in the output.
Is it possible to add the transformed parameter theta_squared <- theta^2
to the existing stanfit
object, as if it had been calculated in a transformed parameters
block?