Some helper functions for stan.
devtools::install_github("paasim/stanutils")
library(rstan)
library(stanutils)
m1 <- "
parameters {
vector[3] y;
}
model {
y ~ std_normal();
}"
fit <- stan(model_code = m1, iter = 300, chains = 2, seed = 456, cores = 1)
# summary as a tibble
summary_tidy(fit)
# extract the sample for y
e <- extract_tidy(fit, y)
e
# mean for each element of the vector
sum_samp_with(e, d1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.