qapx_cf: Approximate quantile via Cornish-Fisher expansion.

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/cornish_fisher.r

Description

Approximate the quantile function of a distribution via its cumulants.

Usage

1
qapx_cf(p, raw.cumulants, support=c(-Inf,Inf), lower.tail = TRUE, log.p = FALSE)

Arguments

p

where to evaluate the approximate distribution.

raw.cumulants

an atomic array of the 1st through kth raw cumulants. The first value is the mean of the distribution, the second should be the variance of the distribution, the remainder are raw cumulants.

support

the support of the density function. It is assumed that the density is zero on the complement of this open interval. This defaults to c(-Inf,Inf) for the normal basis, c(0,Inf) for the gamma basis, and c(0,1) for the Beta, and c(-1,1) for the arcsine and wigner.

lower.tail

whether to compute the lower tail. If false, we approximate the survival function.

log.p

logical; if TRUE, probabilities p are given as log(p).

Details

Given the cumulants of a probability distribution, we approximate the quantile function via a Cornish-Fisher expansion.

Value

The approximate quantile at p.

Note

Monotonicity of the quantile function is not guaranteed.

Author(s)

Steven E. Pav shabbychef@gmail.com

References

Lee, Y-S., and Lin, T-K. "Algorithm AS269: High Order Cornish Fisher Expansion." Appl. Stat. 41, no. 1 (1992): 233-240. http://www.jstor.org/stable/2347649

Lee, Y-S., and Lin, T-K. "Correction to Algorithm AS269: High Order Cornish Fisher Expansion." Appl. Stat. 42, no. 1 (1993): 268-269. http://www.jstor.org/stable/2347433

AS 269. http://lib.stat.cmu.edu/apstat/269

Jaschke, Stefan R. "The Cornish-Fisher-expansion in the context of Delta-Gamma-normal approximations." No. 2001, 54. Discussion Papers, Interdisciplinary Research Project 373: Quantification and Simulation of Economic Processes, 2001. http://www.jaschke-net.de/papers/CoFi.pdf

See Also

dapx_gca, papx_gca, AS269, rapx_cf

Examples

1
2
3
4
5
# normal distribution:
pvals <- seq(0.001,0.999,length.out=501)
q1 <- qapx_cf(pvals, c(0,1,0,0,0,0,0))
q2 <- qnorm(pvals)
q1 - q2

Example output

  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0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