Session Ready
Exercise

Exercise 4. Average size of error

The error \(p-\bar{X}\) is a random variable. In practice, the error is not observed because we do not know the actual proportion of Democratic voters, \(p\). However, we can describe the size of the error by constructing a simulation.

What is the average size of the error if we define the size by taking the absolute value \(\mid p-\bar{X}\mid\) ?

Instructions
100 XP
  • Use the sample code to generate errors, a vector of \(\mid p-\bar{X}\mid\).
  • Calculate the absolute value of errors using the abs function.
  • Calculate the average of these values using the mean function.