Session Ready
Exercise

Hypothesis testing and the binomial distribution (2)

So now we know our hypotheses, let's actually test them. To test hypotheses and calculate p values, we can use the function pbinom(). Looks familiar, doesn't it? Imagine we want to test the hypothesis that a student who scored 18 out of 25 questions did better than randomly guessing, we can calculate the area under the curve, that is, pbinom(17, size = 25, prob = 0.20). While this formula calculates the area under the curve for values below 17 and equal to 17, we need to know the area ABOVE 17. Because the total probability of all possible scores occuring is 1, we can subtract the probability of scores less than or equal to 17 from the total area of 1, and the remaining value will be the probability of a score that is equal to or larger than 18.

Instructions
100 XP
  • Imagine we have a student who got 12 out of 25 questions correctly and the probability of guessing a question correctly is 0.20. Calculate the probability of answering 12 or more questions correctly given that the student is merely guessing and store this in the variable p_value. Round this probability to two digits. Remember that we are doing a one-sided hypothesis test.
  • Print p_value to the console
  • Assign your conclusion whether H0 (the student is merely guessing) is accepted or rejected to the variable conclusion, that is, assign either the value "accepted" or the value "rejected" to the variable conclusion.