bayes.poisson.test: Bayesian First Aid Alternative to the Poisson Test

Description Usage Arguments Details Value Examples

Description

poisson.test estimates the rate parameter for one or two groups of counts using Bayesian estimation assuming a Poisson distribution. This procedure is intended as a replacement for prop.test.

Usage

1
2
3
bayes.poisson.test(x, T = 1, r = 1, alternative = c("two.sided", "less",
  "greater"), cred.mass = 0.95, n.iter = 15000, progress.bar = "none",
  conf.level)

Arguments

x

number of events. A vector of length one or two.

T

time base for event count. A vector of length one or two.

r

hypothesized rate or rate ratio

alternative

ignored and is only retained in order to mantain compatibility with poisson.test.

cred.mass

the amount of probability mass that will be contained in reported credible intervals. This argument fills a similar role as conf.level in poisson.test.

n.iter

The number of iterations to run the MCMC sampling.

progress.bar

The type of progress bar. Possible values are "text", "gui", and "none".

conf.level

same as cred.mass and is only retained in order to mantain compatibility with poisson.test.

Details

Give data on the number of counts x during T periods (e.g., days, hours, years, etc.) the underlying rate λ is estimated assuming the following model:

x ~ Poisson(λ·T)

λ ~ Gamma(0.5, 0.00001)

Here the Gamma prior on λ is an approximation of Jeffrey's' prior for this model. In the case of two groups, both rate parameters are separately estimated using the model above. For two groups, the ratio of the rates is calculated where a ratio of, say, 2.5 would mean that the rate of group 1 is 2.5 times that of group 2. Note that the mean and the highest desity interval for the rate ratio are calculated on the log transformed samples and then transformed back to the original scale.

Value

A list of class bayes_one_sample_poisson_test or bayes_two_sample_poisson_test that contains information about the analysis. It can be further inspected using the functions summary, plot, diagnostics and model.code.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Data from Boice, J. D., & Monson, R. R. (1977). 
# Breast cancer in women after repeated fluoroscopic examinations of the chest.
# Journal of the National Cancer Institute, 59(3), 823-832.

# 41 cases of breast cancer during 28,010 person-years in the treatment group
# of women receiving X-ray fluoroscopy and 15 cases of breast cancer during 
# 19 017 person-years in the control group.

no_cases <- c(41, 15)
no_years <- c(28010, 19017)

bayes.poisson.test(no_cases, no_years)

# Save the return value in order to inspect the model result further.
fit <- bayes.poisson.test(no_cases, no_years)
summary(fit)
plot(fit)

# MCMC diagnostics (should not be necessary for such a simple model)
diagnostics(fit)

# Print out the R code to run the model. This can be copy'n'pasted into
# an R-script and further modified.
model.code(fit)

 

rasmusab/bayesian_first_aid documentation built on May 27, 2019, 2:03 a.m.