distr (version 2.5.3)

Hyper-class: Class "Hyper"

Description

The hypergeometric distribution is used for sampling without replacement. The density of this distribution with parameters m, n and k (named $Np$, $N-Np$, and $n$, respectively in the reference below) is given by $$p(x) = \left. {m \choose x}{n \choose k-x} \right/ {m+n \choose k}$$ for $x = 0, \ldots, k$. C.f. rhyper

Arguments

Objects from the Class

Objects can be created by calls of the form Hyper(m, n, k). This object is a hypergeometric distribution.

Extends

Class "DiscreteDistribution", directly. Class "UnivariateDistribution", by class "DiscreteDistribution". Class "Distribution", by class "DiscreteDistribution".

concept

  • discrete distribution
  • lattice distribution
  • Hypergeometric distribution
  • S4 parameter class
  • generating function

See Also

HyperParameter-class DiscreteDistribution-class Naturals-class rhyper

Examples

Run this code
H <- Hyper(m=3,n=3,k=3) # H is a hypergeometric distribution with m=3,n=3,k=3.
r(H)(1) # one random number generated from this distribution, e.g. 2
d(H)(1) # Density of this distribution is  0.45 for x=1.
p(H)(1) # Probability that x<1 is 0.5.
q(H)(.1) # x=1 is the smallest value x such that p(H)(x)>=0.1.
m(H) # m of this distribution is 3.
m(H) <- 2 # m of this distribution is now 2.

Run the code above in your browser using DataCamp Workspace