mybin: *mybin*

View source: R/mybin.R

mybinR Documentation

mybin

Description

NA

Usage

mybin(iter = 100, n = 10, p = 0.5)

Arguments

iter
n
p

Details

n/a

Note

n/a

Author(s)

na

References

n/a

See Also

n/a

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (iter = 100, n = 10, p = 0.5)
{
    sam.mat = matrix(NA, nr = n, nc = iter, byrow = TRUE)
    succ = c()
    for (i in 1:iter) {
        sam.mat[, i] = sample(c(1, 0), n, replace = TRUE, prob = c(p,
            1 - p))
        succ[i] = sum(sam.mat[, i])
    }
    succ.tab = table(factor(succ, levels = 0:n))
    barplot(succ.tab/(iter), col = rainbow(n + 1), main = "Binomial simulation",
        xlab = "Number of successes")
    succ.tab/iter
  }

arukshpatel/MATH4753.ArukshPatel.SP22 documentation built on March 19, 2022, 3:38 a.m.