Learn R Programming

brr package for R

Bayesian inference on the ratio of two Poisson rates.

What does it do ?

Suppose you have two counts of events and, assuming each count follows a Poisson distribution with an unknown incidence rate, you are interested in the ratio of the two rates (or relative risk). The brr package allows to perform the Bayesian analysis of the relative risk using the natural semi-conjugate family of prior distributions, with a default non-informative prior (see references).

Install

You can install:

  • the latest released version from CRAN with
install.packages("brr")
  • the latest development version from github using the devtools package:
devtools::install_github('stla/brr', build_vignettes=TRUE)

Basic usage

Create a brr object with the Brr function to set the prior parameters a, b, c, d, the two Poisson counts x and y and the samples sizes (times at risk) S and T in the two groups. Simply do not set the prior parameters to use the non-informative prior:

model <- Brr(x=2, S=17877, y=9, T=16674)

Plot the posterior distribution of the rate ratio phi:

plot(model, dpost(phi))

Get credibility intervals about phi:

confint(model)

Get the posterior probability that phi>1:

ppost(model, "phi", 1, lower.tail=FALSE)

Update the brr object to include new sample sizes and get a summary of the posterior predictive distribution of x:

model <- model(Snew=10000, Tnew=10000)
spost(model, "x", output="pandoc")

To learn more

Look at the vignettes:

browseVignettes(package = "brr")

Find a bug ? Suggestion for improvment ?

Please report at https://github.com/stla/brr/issues

References

S. Laurent, C. Legrand: A Bayesian framework for the ratio of two Poisson rates in the context of vaccine efficacy trials. ESAIM, Probability & Statistics 16 (2012), 375--398.

S. Laurent: Some Poisson mixtures distributions with a hyperscale parameter. Brazilian Journal of Probability and Statistics 26 (2012), 265--278.

S. Laurent: Intrinsic Bayesian inference on a Poisson rate and on the ratio of two Poisson rates. Journal of Statistical Planning and Inference 142 (2012), 2656--2671.

Copy Link

Version

Install

install.packages('brr')

Monthly Downloads

22

Version

1.0.0

License

GPL-2

Maintainer

Stéphane Laurent

Last Published

September 7th, 2015

Functions in brr (1.0.0)

GIBDist

Gamma-Inverse Beta distribution
PGB2Dist

Poisson-Gamma-Beta2 distribution
Intrinsic2Inference

Intrinsic inference on the rates ratio based on the second intrinsic discrepancy.
intrinsic_discrepancy

Intrinsic discrepancy
Posterior_lambda

Posterior distribution on the incidence rate in the treated group
BNBDist

Beta-negative binomial distribution
plot.brr

plot brr
Post_x

Posterior predictive distribution of the count in the treated group
Prior_x_given_y

Prior predictive distribution of the count $x$ in the treated group conditionally to the count $y$ in the treated group
IntrinsicInference

Intrinsic inference on the rate ratio.
PriorAndPosterior

Prior and posterior distributions
brr-package

Bayesian inference on the ratio of two Poisson rates
Prior_phi

Prior distribution on the relative risk and the vaccine efficacy
Prior_mu

Prior distribution on the rate in the control group
summary_gamma

Summary of a Gamma distribution
summary_nbinom

Summary of a Negative Binomial distribution
inference.brr

Credibility intervals and estimates
Posterior_phi

Posterior distribution on the relative risk and the vaccine efficacy
FrequentistInference

Frequentist inference about the relative risk
Posterior_mu

Posterior distribution on the rate in the control group
Prior_x

Prior predictive distribution of the count in the treated group
Post_y

Posterior predictive distribution of the count in the control group
Beta2Dist

Beta distribution of the second kind
Inference

Inference summaries
Prior_lambda

Prior distribution on the incidence rate in the treated group
intrinsic2_discrepancy

Second intrinsic discrepancy
Brr

Creation and summary of a brr object
GB2Dist

Gamma-Beta2 distribution
PGIBDist

Poisson-Gamma-Inverse Beta distribution
Prior_y

Prior predictive distribution of the count in the control group