data(epi.SClip)
obs <- epi.SClip$cases; pop <- epi.SClip$population
est <- epi.empbayes(obs, pop)
empbayes.prop <- (obs + est[4]) / (pop + est[3])
raw.prop <- (obs) / (pop)
rank <- rank(raw.prop)
dat <- data.frame(rank, raw.prop, empbayes.prop)
plot(dat$rank, dat$raw.prop, type = "n", xlab = "Rank", ylab = "Risk")
points(dat$rank, dat$raw.prop, pch = 16, col = "red")
points(dat$rank, dat$empbayes.prop, pch = 16, col = "blue")
legend(x = "topleft", legend = c("Raw estimate", "Bayes adjusted estimate"),
col = c("red","blue"), pch = c(16,16), bty = "n")
Run the code above in your browser using DataLab