Learn R Programming

epiR (version 0.9-38)

epi.empbayes: Empirical Bayes estimates

Description

Computes empirical Bayes estimates of observed event counts using the method of moments.

Usage

epi.empbayes(obs, pop)

Arguments

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.

Value

  • 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.

Details

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 / \alpha$. The variance of the distribution equals $\delta / \alpha^{2}$. The empirical Bayes estimate of the proportion affected in each area equals $(obs + \delta) / (pop + \alpha)$.

References

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.

Examples

Run this code
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")

Run the code above in your browser using DataLab