Learn R Programming

DPQ (version 0.5-3)

phyperApprAS152: Normal Approximation to cumulative Hyperbolic Distribution -- AS 152

Description

Compute the normal approximation (via pnorm(.) from AS 152 to the cumulative hyperbolic distribution function phyper().

Usage

phyperApprAS152(q, m, n, k)

Value

a numeric vector of the same length (etc) as q.

Arguments

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,\dots, m+n\).

Author

Martin Maechler, 19 Apr 1999

References

Lund, Richard E. (1980) Algorithm AS 152: Cumulative Hypergeometric Probabilities. Journal of the Royal Statistical Society. Series C (Applied Statistics), 29(2), 221--223. tools:::Rd_expr_doi("10.2307/2986315")

Shea, B. (1989) Remark AS R77: A Remark on Algorithm AS 152: Cumulative Hypergeometric Probabilities. JRSS C (Applied Statistics), 38(1), 199--204. tools:::Rd_expr_doi("10.2307/2347696")

Berger, R. (1991) Algorithm AS R86: A Remark on Algorithm AS 152: Cumulative Hypergeometric Probabilities. JRSS C (Applied Statistics), 40(2), 374--375. tools:::Rd_expr_doi("10.2307/2347606")

See Also

Examples

Run this code
##---- 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 (q, m, n, k)
{
    kk <- n
    nn <- m
    mm <- m + n
    ll <- q
    mean <- kk * nn/mm
    sig <- sqrt(mean * (mm - nn)/mm * (mm - kk)/(mm - 1))
    pnorm(ll + 1/2, mean = mean, sd = sig)
  }

Run the code above in your browser using DataLab