Session Ready
Exercise

Simulate sign errors: changing probabilities

In the previous exercise, each simulation had a fixed probability of a sign error at each step.

In the original question as posed, the probability of a sign error can be different at each step; the only requirement is that each probability is less than 0.50.

Here, let us simulate a math problem with 2 steps in which the probability of a switch on each step is 0.49 and 0.01, meaning that there is a high probability of becoming incorrect on the first step and a low probability of switching back.

Instructions
100 XP
  • Use the sapply function with the rbinom function to simulate the switches within one problem, with switch probabilities of 0.49 and 0.01 for the first and second steps, respectively.
  • Determine the total number of switches that occurred.
  • Determine whether the answer to the math problem would be correct or not.