Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

NoncenHypergeom

The Noncentral Hypergeometric Distribution


Description

Evaluates the density at a single point or all points, and generate random draws from the Noncentral Hypergeometric distribution.

Usage

dnoncenhypergeom(x = NA, n1, n2, m1, psi)

rnoncenhypergeom(n, n1, n2, m1, psi)

Arguments

x

The location to evaluate the density. If x is NA, then a matrix is returned with the density evaluated at all possible points.

n1

The size of group one.

n2

The size of group two.

m1

The observed number of positive outcomes (in both groups).

psi

Odds ratio.

n

The number of draws to make from the distribution.

Details

The Noncentral Hypergeometric is particularly useful for conditional inference for (2 \times 2) tables. We use the parameterization and algorithms of Liao and Rosen (2001). The underlying R code is based on their published code. See their article for details of the parameterization.

Value

dnoncenhypergeom evaluates the density at point x, or a matrix with the first column containing the possible values of the random variable, and the second column containing the probabilities.

rnoncenhypergeom returns a list of n random draws from the distribution.

Source

J. G. Liao and Ori Rosen. 2001. “Fast and Stable Algorithms for Computing and Sampling From the Noncentral Hypergeometric Distribution." The American Statistician. 55: 366-369.

Examples

density <- dnoncenhypergeom(NA, 500, 500, 500, 6.0)
  draws <- rnoncenhypergeom(10, 500, 500, 500, 6.0)

MCMCpack

Markov Chain Monte Carlo (MCMC) Package

v1.5-0
GPL-3
Authors
Andrew D. Martin [aut], Kevin M. Quinn [aut], Jong Hee Park [aut,cre], Ghislain Vieilledent [ctb], Michael Malecki[ctb], Matthew Blackwell [ctb], Keith Poole [ctb], Craig Reed [ctb], Ben Goodrich [ctb], Ross Ihaka [cph], The R Development Core Team [cph], The R Foundation [cph], Pierre L'Ecuyer [cph], Makoto Matsumoto [cph], Takuji Nishimura [cph]
Initial release
2021-01-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.