Session Ready
Exercise

Binomial confidence intervals

SMRs above 1 represent high rates of disease - but how high does an SMR need to be before it can be considered statistically significant?

Given a number of cases and a population, its possible to work out confidence intervals at some level of the estimate of the ratio of cases per population using the properties of the binomial distribution. The epitools package has a function binom.exact() which you can use to compute confidence intervals for the flu data. These can be scaled to be confidence intervals on the SMR by dividing by the overall rate.

Instructions
100 XP

The london data set and the sp package are loaded.

  • Compute the data frame of confidence intervals from the observed flu case and total population columns.

  • flu_ci is in the same order as london, so we can add the borough names.

  • The SMR can be obtained from a proportion (OBS/TOTAL) by dividing the proportion by the overall rate.

  • Select only the boroughs with SMR over 1.

  • Draw a point range ggplot of the SMR estimates and confidence intervals by borough.

    • The x aesthetic is NAME.
    • The y aesthetic is proportion divided by the incidence rate, r.
    • The ymin and ymax aesthetics are lower and upper divided by r respectively.
    • Add a point range geom using geom_pointrange().