At a particular blood bank, 45% of donors have type O blood. On a certain day, the blood bank needed 4 donors with type O blood and it took 12 donors to meet their quota. This surprised the director since it usually doesn’t take that many donors to find 4 with type O blood. Could this have occurred by random chance or were people with type O blood particularly stingy on that day? Design and conduct a simulation (do 10 runs) to estimate the probability it takes 12 or more donors to get 4 with type O blood. On average, how many donors does it take to get 4 with type O blood?
R code:
count=0
count2=0
n=10 # No. of iterations
for(i in 1:n)
{
x=runif(11) #Generating random number from uniform( 0
, 1)
for(i in 1:11)
{
if(x[i]<.45) count=count+1
#counting the donners with o blood
}
if(count>=4)
{
count2=count2+1 #counting how meny
times less than 12 donners needed
}
count=0
}
cat("The required probability is",(n-count2)/n)
Result:
The required probability is 0.2
Get Answers For Free
Most questions answered within 1 hours.