knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library("bayz")
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.