phyperApprAS152 {DPQ}R Documentation

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)

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.

Value

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

Note

I have Fortran (and C code translated from Fortran) which says

   ALGORITHM AS R77  APPL. STATIST. (1989), VOL.38, NO.1
   Replaces AS 59 and AS 152
   Incorporates AS R86 from vol.40(2)
 

Author(s)

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. 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. 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. doi:10.2307/2347606

See Also

phyper

Examples

##---- 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)
  }

[Package DPQ version 0.5-8 Index]