if (FALSE) {
# Extracting the yrep variable for general use:
# extract yrep
y_rep <- extract(object$stanfit, pars = "y_rep", permuted = TRUE)$y_rep
# For non-gaussian model:
weights <- extract(object$stanfit,
pars = "weights", permuted = TRUE)$weights
y_rep <- y_rep[sample(1:nrow(y_rep),
size = nrow(y_rep), replace = TRUE, prob = weights), , drop = FALSE]
}
Run the code above in your browser using DataLab