Learn R Programming

BayesFactor (version 0.9.8)

contingencyTableBF: Function for Bayesian analysis of one- and two-sample designs

Description

This function computes Bayes factors for contingency tables.

Usage

contingencyTableBF(x, sampleType, priorConcentration = 1, posterior = FALSE,
  ...)

Arguments

x
an m by n matrix of counts (integers m,n > 1)
sampleType
the sampling plan (see details)
priorConcentration
prior concentration parameter (see details)
posterior
if TRUE, return samples from the posterior instead of Bayes factor
...
further arguments to be passed to or from methods.

Value

  • If posterior is FALSE, an object of class BFBayesFactor containing the computed model comparisons is returned.

    If posterior is TRUE, an object of class BFmcmc, containing MCMC samples from the posterior is returned.

Details

The Bayes factor provided by contingencyTableBF tests the independence assumption in contingency tables under various sampling plans.

References

Gunel, E. and Dickey, J., (1974) Bayes Factors for Independence in Contingency Tables. Biometrika, 61, 545-557

Examples

Run this code
data<-matrix(c(10,3,2,15),c(2,2))

## Assume poisson sampling scheme
contingencyTableBF(data, "poisson")

Run the code above in your browser using DataLab