How do you calculate the margin of error? What criteria should you use to select appropriate statistical tools?
In this RStudio activity, you will practice your R skills by running simulations of random experiments to calculate the margin of error for each experiment. To achieve this, you will:
Explore probability by choosing appropriate statistical tools.
Apply the corresponding code blocks in RStudio, as explained in the Activity 1 video and subsequent steps.
You will be given four specific tasks for you to complete in this RStudio activity. This activity will take approximately two hours to finish. To follow along more easily, keep this step, the task step you are working on, and your RStudio session open in separate browser tabs so you can refer to the instructions while you work. Model solutions are provided at the end of the step to help you review your work.
This activity demonstrates the Law of Large Numbers, showing how the frequencies of outcomes stabilise in long-term sequences of random trials. Such observations help develop statistical intuition by providing experimental support for the concept of probability.
In the R activity, you will be given the coding examples shared in Activity 1 to conduct your own simulations (e.g tossing a coin or rolling a dice) and verify the convergence of relative frequencies to their expected probabilities.
For instance, you may intuitively expect a probability of 1/2 for heads in a fair coin toss or 1/6 for rolling a six on a fair dice. By conducting long-term simulations, you can numerically evaluate these probabilities as the relative frequency of the event of interest (for example, sequences like ‘6666’ in dice rolls or shared birthdays in a group).
These experimental estimates of probabilities are approximate and depend on the specific sequence of random outcomes. They will vary if the sequence is repeated. The accuracy of these estimates improves with more replicated experiments. The reading explains how to estimate a confident margin of error (MOE) for a finite sequence of trials.
You can download the Zip file Lab-2-Lets-measure-probability from the ‘Downloads’ section below and then open the file in RStudio.
Post session review
After completing your session, download the R scriptLab-2-Model-solutions-lets-measure-probabability from the ‘Downloads’ section below to see the model solutions. Upload the file into your RStudio session to do the review and compare your answers to the ones given in the file.
Next steps
You are ready to start working in RStudio. Use this reading for the instructions. Select Next to move onto the first task.
Practical ideas for accessing the reading during your session:
Open the reading on a second screen if available.
Print the reading as a PDF to review on another device.
Print it onto paper for reference while you work in RStudio.
Now, open your version of RStudio to begin working on the five topics.