Example 1: What does the following R code do? Begin with the first line and do it several times. Use help rbinom to help you figure out what is going on. Then progress to the second line of code.
rbinom(1,100,.5) rbinom(20,100,.5)Example 2: Now consider the following code. What is it doing?
n <- 400 p <- .5 k <- 3 mu <- n*p sigma <- sqrt(n*p*(1-p)) reps <- 100 # Note: after you figure out the code, increase reps x <- rbinom(reps, n, p) sum( (x >= mu-k*sigma) & (x <= mu + k*sigma) )