## ----setup, include = FALSE--------------------------------------------------- set.seed(123) library("ibist") ## ----gamma-shape-0.5---------------------------------------------------------- demo_clt(rgamma, n = c(5, 10, 20, 40), nrep = 10000, shape = 0.5, rate = 1, pmean = 0.5, psd = sqrt(0.5)) ## ----gamma-shape-1------------------------------------------------------------ demo_clt(rgamma, n = c(5, 10, 20, 40), nrep = 10000, shape = 1, rate = 1, pmean = 1, psd = sqrt(1)) ## ----gamma-shape-2------------------------------------------------------------ demo_clt(rgamma, n = c(5, 10, 20, 40), nrep = 10000, shape = 2, rate = 1, pmean = 2, psd = sqrt(2)) ## ----mixture------------------------------------------------------------------ mymix_rng <- function(n, rate = 0.5) { ifelse(runif(n) < rate, rgamma(n, shape = 0.5), rgamma(n, shape = 4)) } demo_clt(mymix_rng, n = c(5, 10, 20, 40))