dapx_edgeworth: Approximate density and distribution via Edgeworth expansion. In shabbychef/PDQutils: PDQ Functions via Gram Charlier, Edgeworth, and Cornish Fisher Approximations

Description

Approximate the probability density or cumulative distribution function of a distribution via its raw cumulants.

Usage

 ```1 2 3``` ```dapx_edgeworth(x, raw.cumulants, support=c(-Inf,Inf), log=FALSE) papx_edgeworth(q, raw.cumulants, support=c(-Inf,Inf), lower.tail=TRUE, log.p=FALSE) ```

Arguments

 `x` where to evaluate the approximate density. `raw.cumulants` an atomic array of the 1st through kth raw cumulants of the probability distribution. The first cumulant is the mean, the second is the variance. The third is not the typical unitless skew. `support` the support of the density function. It is assumed that the density is zero on the complement of this open interval. `log` logical; if TRUE, densities f are given as log(f). `q` where to evaluate the approximate distribution. `log.p` logical; if TRUE, probabilities p are given as log(p). `lower.tail` whether to compute the lower tail. If false, we approximate the survival function.

Details

Given the raw cumulants of a probability distribution, we can approximate the probability density function, or the cumulative distribution function, via an Edgeworth expansion on the standardized distribution. The derivation of the Edgeworth expansion is rather more complicated than that of the Gram Charlier approximation, involving the characteristic function and an expression of the higher order derivatives of the composition of functions; see Blinnikov and Moessner for more details. The Edgeworth expansion can be expressed succinctly as

sigma f(sigma x) = phi(x) + phi(x) sum_{1 <= s} sigma^s sum_{k_m} He_{s+2r}(x) c_{k_m},

where the second sum is over some partitions, and the constant c involves cumulants up to order s+2. Unlike the Gram Charlier expansion, of which it is a rearrangement, the Edgeworth expansion is arranged in increasing powers of the standard deviation sigma.

Value

The approximate density at `x`, or the approximate CDF at `q`.

Note

Monotonicity of the CDF is not guaranteed.

Author(s)

Steven E. Pav [email protected]

References

S. Blinnikov and R. Moessner. "Expansions for nearly Gaussian distributions." Astronomy and Astrophysics Supplement 130 (1998): 193-205. http://arxiv.org/abs/astro-ph/9711239

the Gram Charlier expansions, `dapx_gca, papx_gca`
 ``` 1 2 3 4 5 6 7 8 9 10``` ```# normal distribution, for which this is silly xvals <- seq(-2,2,length.out=501) d1 <- dapx_edgeworth(xvals, c(0,1,0,0,0,0)) d2 <- dnorm(xvals) d1 - d2 qvals <- seq(-2,2,length.out=501) p1 <- papx_edgeworth(qvals, c(0,1,0,0,0,0)) p2 <- pnorm(qvals) p1 - p2 ```