DPQ (version 0.3-3)

pnchisqWienergerm: Wienergerm Approximations to (Non-Central) Chisquare Probabilities

Description

Functions implementing the two Wiener germ approximations to pchisq(), the (non-central) chisquare distribution, and to qchisq() its inverse, the quantile function.

These have been proposed by Penev and Raykov (2000) who also listed a Fortran implementation.

In order to use them in numeric boundary cases, Martin Maechler has improved the original formulas.

Auxiliary functions:

sW():

The \(s()\) as in the Wienergerm approximation, but using Taylor expansion when needed, i.e., (x*ncp / df^2) << 1.

qs():

...

z0():

...

z.f():

...

z.s():

...

.................. ..................

Usage



pchisqW. (q, df, ncp = 0, lower.tail = TRUE, log.p = FALSE,
          Fortran = TRUE, variant = c("s", "f"))
pchisqV  (q, df, ncp = 0, lower.tail = TRUE, log.p = FALSE,
          Fortran = TRUE, variant = c("s", "f"))
pchisqW  (q, df, ncp = 0, lower.tail = TRUE, log.p = FALSE, variant = c("s", "f"))
pchisqW.R(x, df, ncp = 0, lower.tail = TRUE, log.p = FALSE, variant = c("s", "f"),
          verbose = getOption("verbose"))

sW(x, df, ncp) qs(x, df, ncp, f.s = sW(x, df, ncp), eps1 = 1/2, sMax = 1e+100) z0(x, df, ncp) z.f(x, df, ncp) z.s(x, df, ncp, verbose = getOption("verbose"))

Arguments

q,x

vector of quantiles (main argument, see pchisq).

df

degrees of freedom (non-negative, but can be non-integer).

ncp

non-centrality parameter (non-negative).

lower.tail,log.p
variant

a character string, currently either "f" for the first or "s" for the second Wienergerm approximation in Penev \& Raykov (2000).

Fortran

logical specifying if the Fortran or the C version should be used.

verbose

logical (or integer) indicating if or how much diagnostic output should be printed to the console during the computations.

f.s

a number must be a “version” of \(s(x, df, ncp)\).

eps1

for qs(): use direct approximation instead of h(1 - 1/s) for s < eps1.

sMax

for qs(): cutoff to switch the \(h(.)\) formula for s > sMax.

Value

all these functions return numeric vectors according to their arguments.

Details

....TODO... or write vignette

References

Penev, Spiridon and Raykov, Tenko (2000) A Wiener Germ approximation of the noncentral chi square distribution and of its quantiles. Computational Statistics 15, 219--228. 10.1007/s001800000029

Dinges, H. (1989) Special cases of second order Wiener germ approximations. Probability Theory and Related Fields, 83, 5--57.

See Also

pchisq, and other approximations for it: pnchisq() etc.

Examples

Run this code
# NOT RUN {
## see  example(pnchisqAppr)   which looks at all of the pchisq() approximating functions
# }
# NOT RUN {
<!-- % ../tests/wienergerm-accuracy.R -->
# }
# NOT RUN {
<!-- % ../tests/wienergerm-pchisq-tst.R -->
# }
# NOT RUN {
<!-- % ../tests/wienergerm_nchisq.R -->
# }

Run the code above in your browser using DataCamp Workspace