epi.empbayes {epiR} | R Documentation |
Computes empirical Bayes estimates of observed event counts using the method of moments.
epi.empbayes(obs, pop)
obs |
a vector representing the observed disease counts in each region of interest. |
pop |
a vector representing the population count in each region of interest. |
The gamma distribution is sometimes parameterised in terms of shape and rate parameters. The rate parameter equals the inverse of the scale parameter. The mean of the distribution equals delta / α. The variance of the distribution equals delta / α^{2}. The empirical Bayes estimate of the proportion affected in each area equals (obs + delta) / (pop + α).
A data frame with four elements: gamma
mean observed event count, phi
variance of observed event count, alpha
shape parameter of gamma distribution, and delta
scale parameter of gamma distribution.
Bailey TC, Gatrell AC (1995). Interactive Spatial Data Analysis. Longman Scientific & Technical. London.
Langford IH (1994). Using empirical Bayes estimates in the geographical analysis of disease risk. Area 26: 142 - 149.
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 <- as.data.frame(cbind(rank, raw.prop, empbayes.prop)) plot(dat$rank, dat$raw.prop, type = "n", xlab = "Rank", ylab = "Proportion") points(dat$rank, dat$raw.prop, pch = 16, col = "red") points(dat$rank, dat$empbayes.prop, pch = 16, col = "blue") legend(5, 0.00025, legend = c("Raw estimate", "Bayes adjusted estimate"), col = c("red","blue"), pch = c(16,16), bty = "n")