--- output: pdf_document --- Math 151- Probability Spring 2015 Jo Hardin Example, T/F Quiz ======================================================== Baumgartner, Prosser, and Crowell are grading a calculus exam. There is a true-false question with ten parts. Baumgartner notices that one student has only two out of the ten correct and remarks, ``The student was not even bright enough to have flipped a coin to determine his answers.'' ``Not so clear,'' says Prosser. ``With 340 students I bet that if they all flipped coins to determine their answers there would be at least one exam with two or fewer answers correct.'' Crowell says, ``I’m with Prosser. In fact, I bet that we should expect at least one exam in which no answer is correct if everyone is just guessing.'' Who is right in all of this? ```{r warning=FALSE, message=FALSE, fig.width=3, fig.height=2} library(mosaic) student1 = rbinom(1,10,.5) student1 student340 = rbinom(340,10,.5) student340[1:10] histogram(student340 ) tally(~student340) favstats(~student340) ``` But that's only for one class... we'd want to repeat the simulation to understand how *likely* it is for a class to have a student (who is guessing) with no correct answers. ```{r} n.reps = 10 allscores = array(dim=c(n.reps,7)) for(i in 1:n.reps){ allscores[i,] = rbinom(7,10,.5) } allscores numZero = apply(allscores ==0, 1,sum ) numZero sum(numZero > 0)/n.reps numFew = apply(allscores <=2, 1,sum ) numFew sum(numFew > 0)/n.reps ```