knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library("bayz")

Post-processing Stan Results

The function with_mcmc_iter can be used to post-process the results of stanfit objects by evaluating expressions within each iteration.

library(rstan)
scode <- "
parameters {
  real y[2]; 
} 
model {
  y[1] ~ normal(0, 1);
  y[2] ~ double_exponential(0, 2);
} 
"
fit1 <- stan(model_code = scode, iter = 10, verbose = FALSE,
             refresh = -1)
with_mcmc_iter(fit1, sum(y))


jrnold/bayz documentation built on May 5, 2019, 5:52 p.m.