I have a Stan model (called fit
) and I'm getting some strange results. I know that I'm probably missing something, but I can't see where and what. In this case I want to look at the parameter sigma_h
.
If I use as.matrix
to get the samples from fit
I get the following result:
posterior <- as.matrix(fit)
trace_sigma_h <- posterior[,colnames(posterior) %in% "sigma_h"]
ts.plot(trace_sigma_h)
This is the same plot I get when using the rstan::traceplot
function.
If I extract the samples from the fit
object and plots it I get
samples <- extract(fit,inc_warmup = FALSE)
ts.plot(samples$sigma_h)
These plots are not the same. What am I missing? Is there a difference between just making the fit
object a matrix and extracting the samples?