| phyperR {DPQ} | R Documentation |
An R version of the first phyper() algorithm in R, which was
used up to svn rev 30227 on 2004-07-09.
phyperR(q, m, n, k)
q |
vector of quantiles representing the number of white balls drawn without replacement from an urn which contains both black and white balls. |
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,…, m+n. |
a numeric vector similar to phyper(q, m, n, k).
The original argument list in C was (x, NR, NB, n) where
there were red and black balls in the urn.
Note that we have vectorized a translation to R of the original C code.
Martin Maechler
m <- 9:12; n <- 7:10; k <- 10
x <- 0:(k+1) # length 12
for(. in 0:11) stopifnot(
all.equal(phyper (., m=10, n=8, k=10),
phyperR(., m=10, n=8, k=10), tol=1e-12))
## BUT the vectorization fails badly : FIXME! %% <<<<<< FIXME <<<<<<<<<<<<<<<
(A <- cbind(x, m, n, k)) # shows the recycling
cbind(A, ph = phyper (x, m, n, k),
phR = phyperR(x, m, n, k))