Session Ready
Exercise

Exercise 7. Standard error of the estimate

In practice, we don't know \(p\), so we construct an estimate of the theoretical prediction based by plugging in \(\bar{X}\) for \(p\). Calculate the standard error of the estimate: $$\hat{\mbox{SE}}(\bar{X})$$

Instructions
100 XP
  • Simulate a poll X using the sample function.
  • When using the sample function, create a vector using c() that contains all possible polling options where '1' indicates a Democratic voter and '0' indicates a Republican voter.
  • When using the sample function, use replace = TRUE within the sample function to indicate that sampling from the vector should occur with replacement.
  • When using the sample function, use prob = within the sample function to indicate the probabilities of selecting either element (0 or 1) within the vector of possibilities.
  • Use the mean function to calculate the average of the simulated poll, X_bar.
  • Calculate the standard error of the X_bar using the sqrt function and print the result.