R/sim_post.R

Defines functions sim_post

Documented in sim_post

sim_post <- function(x,
 n,
 alpha = 1,
 beta = 1,
 ndraws = 5000
) {
  k <- length(x)
  ans <- matrix(nrow=ndraws, ncol=k)
  no = n-x
  for (i in (1:k))
    ans[,i] = rbeta(ndraws, x[i] + alpha, no[i] + beta)
  return(ans)
}

Try the bandit package in your browser

Any scripts or data that you put into this service are public.

bandit documentation built on June 29, 2022, 5:05 p.m.