Learn R Programming

DPQ (version 0.4-3)

phypers: The Four (4) Symmetric phyper() calls.

Description

Compute the four (4) symmetric phyper() calls which mathematically would be identical but in practice typically slightl differ numerically.

Usage

phypers(m, n, k, q = .suppHyper(m, n, k))

Arguments

m

the number of white balls in the urn.

n

the number of black balls in the urn.

k

the number of balls drawn from the urn, hence must be in \(0,1,\dots, m+n\).

q

vector of quantiles representing the number of white balls drawn without replacement from an urn which contains both black and white balls. The default ......... FIXME

Value

a list with components

q

Description of 'comp1'

phyp

a numeric matrix of 4 columns with the 4 different calls to phyper() which are theoretically equivalent because of mathematical symmetry.

References

Johnson et al

See Also

phyper.

Examples

Run this code
# NOT RUN {
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (m, n, k, q = .suppHyper(m, n, k))
{
    N <- m + n
    pm <- cbind(ph = phyper(q, m, n, k), p2 = phyper(q, k, N -
        k, m), Ip2 = phyper(m - 1 - q, N - k, k, m, lower.tail = FALSE),
        Ip1 = phyper(k - 1 - q, n, m, k, lower.tail = FALSE))
    stopifnot(all.equal(pm[, 1], pm[, 2]), all.equal(pm[, 2],
        pm[, 3]), all.equal(pm[, 3], pm[, 4]))
    list(q = q, phyp = pm)
  }
# }

Run the code above in your browser using DataLab