5) Let\'s do some R.... Suppose you have the following situation: You have a lar
ID: 3305802 • Letter: 5
Question
5) Let's do some R.... Suppose you have the following situation: You have a large jar of beans, 7% black, 93% white. You take a sample of 11 beans.
a) Use R to figure out the probability for every single possible outcome. In other words, you need to calculate: Pr{0 black beans in 11 trials} Pr{1 black bean in 11 trials} . . etc. . Pr{11 black beans in 11 trials}
b) Once you have this information, you need to plot a histogram that shows you what this distribution looks like (actually, this would be a barplot). As you might guess, you'll need to use the binomial (in R) to solve this problem. Make sure you present all your results (you should have a list of probabilities and the histogram/barplot).
Explanation / Answer
(a) x <- c(0:11)
P <- dbinom( x, size = 11, prob = .07)
The above lines of R code will give us “P” with all the binomial probabilities. They will be in order from 0 to 11.
(b) barplot(P,names.arg = x, ylab = "Frequency", xlab = "Number of black beans", col = "red")
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.