R: Peizer's Normal Approximation to the Cumulative Hyperbolic

phyperPeizer {DPQ} | R Documentation

## Peizer's Normal Approximation to the Cumulative Hyperbolic

### Description

Compute Peizer's extremely good normal approximation to the cumulative hyperbolic distribution.

This implementation corrects a typo in the reference

### Usage

    phyperPeizer(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,…, m+n.

### Value

. .

### Author(s)

Martin Maechler

### References

Johnson, Kotz & Kemp (1992): (6.93) & (6.94), p.261 CORRECTED by M.M.

### See Also

`phyper`.

### Examples

    ## The function is currently defined as

    phyperPeizer <- function(q, m, n, k)
    {
      ## Purpose: Peizer's extremely good Normal Approx. to cumulative Hyperbolic
      ##  Johnson, Kotz & Kemp (1992):  (6.93) & (6.94), p.261 __CORRECTED__
      ## ----------------------------------------------------------------------
      Np <- m; N <- n + m; n <- k; x <- q
      ## (6.94) -- in proper order!
      nn <- Np			;  n. <- Np     + 1/6
      mm <- N - Np                  ;  m. <- N - Np + 1/6
      r <- n                        ;  r. <- n      + 1/6
      s <- N - n                    ;  s. <- N - n  + 1/6
                                       N. <- N      - 1/6
      A <- x + 1/2                  ;  A. <- x      + 2/3
      B <- Np - x - 1/2             ;  B. <- Np - x - 1/3
      C <- n  - x - 1/2             ;  C. <- n  - x - 1/3
      D <- N - Np - n + x + 1/2     ;  D. <- N - Np - n + x + 2/3

      n <- nn
      m <- mm
      ## After (6.93):
      L <-
        A * log((A*N)/(n*r)) +
        B * log((B*N)/(n*s)) +
        C * log((C*N)/(m*r)) +
        D * log((D*N)/(m*s))
      ## (6.93) :
      pnorm((A.*D. - B.*C.) / abs(A*D - B*C) *
            sqrt(2*L* (m* n* r* s* N.)/
                      (m.*n.*r.*s.*N )))
      # The book wrongly has an extra "2*" before `m* ' (after "2*L* (" ) above
    }

[Package DPQ version 0.5-2 Index]