Session Ready
Exercise

Exercise 2 - Compare to Actual Results

You can add the final result to the cis table you just created using the left_join function as shown in the sample code.

Now determine how often the 95% confidence interval includes the actual result.

Instructions
100 XP
  • Create an object called p_hits that contains the proportion of intervals that contain the actual spread using the following two steps.
  • Use the mutate function to create a new variable called hit that contains a logical vector for whether the actual_spread falls between the lower and upper confidence intervals.
  • Summarize the proportion of values in hit that are true using the mean function inside of summarize.