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

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) = choose(m, x) choose(n, k-x) / choose(m+n, k)

for x = 0, ..., k. C.f. rhyper

Objects from the Class

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

Slots

img

Object of class "Naturals": The space of the image of this distribution has got dimension 1 and the name "Natural Space".

param

Object of class "HyperParameter": the parameter of this distribution (m, n, k), declared at its instantiation

r

Object of class "function": generates random numbers (calls function rhyper)

d

Object of class "function": density function (calls function dhyper)

p

Object of class "function": cumulative function (calls function phyper)

q

Object of class "function": inverse of the cumulative function (calls function qhyper). The alpha-quantile is defined as the smallest value x such that p(x) >= alpha, where p is the cumulative function.

support:

Object of class "numeric": a (sorted) vector containing the support of the discrete density function

.withArith

logical: used internally to issue warnings as to interpretation of arithmetics

.withSim

logical: used internally to issue warnings as to accuracy

.logExact

logical: used internally to flag the case where there are explicit formulae for the log version of density, cdf, and quantile function

.lowerExact

logical: used internally to flag the case where there are explicit formulae for the lower tail version of cdf and quantile function

Symmetry

object of class "DistributionSymmetry"; used internally to avoid unnecessary calculations.

Extends

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

Methods

initialize

signature(.Object = "Hyper"): initialize method

m

signature(object = "Hyper"): returns the slot m of the parameter of the distribution

m<-

signature(object = "Hyper"): modifies the slot m of the parameter of the distribution

n

signature(object = "Hyper"): returns the slot n of the parameter of the distribution

n<-

signature(object = "Hyper"): modifies the slot n of the parameter of the distribution

k

signature(object = "Hyper"): returns the slot k of the parameter of the distribution

k<-

signature(object = "Hyper"): modifies the slot k of the parameter of the distribution

Author(s)

Thomas Stabla statho3@web.de,
Florian Camphausen fcampi@gmx.de,
Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de,
Matthias Kohl Matthias.Kohl@stamats.de

See Also

Examples

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.
## in RStudio or Jupyter IRKernel, use q.l(.)(.) instead of q(.)(.)
m(H) # m of this distribution is 3.
m(H) <- 2 # m of this distribution is now 2.

distr

Object Oriented Implementation of Distributions

v2.8.0
LGPL-3
Authors
Florian Camphausen [ctb] (contributed as student in the initial phase --2005), Matthias Kohl [aut, cph], Peter Ruckdeschel [cre, cph], Thomas Stabla [ctb] (contributed as student in the initial phase --2005), R Core Team [ctb, cph] (for source file ks.c/ routines 'pKS2' and 'pKolmogorov2x')
Initial release
2019-03-11

We don't support your browser anymore

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