R/mean_binomial_sample.R

Defines functions mean_binomial_sample

Documented in mean_binomial_sample

#' Mean of Binomial Samples
#'
#' @param samplesize This is the size of the random sample that you want to generate
#' @param n This is the number of trials in the binomial distribution
#' @param p This is the probability in the binomial distribution
#'
#' @return The function returns the mean of the random sample of binomial distribution generated.
#' @export
#'
#' @examples
#' mean_binomial_sample(50,10,0.5)
mean_binomial_sample <- function(samplesize, n = 2, p = 0.5){
  mean(rbinom(samplesize, n, p))
}
hzwangjiren/jiren441final documentation built on Jan. 1, 2021, 3:23 a.m.