Learn R Programming

PDQutils (version 0.1.6)

dapx_edgeworth: Approximate density and distribution via Edgeworth expansion.

Description

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

Usage

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 \(\mbox{log}(f)\).
q
where to evaluate the approximate distribution.
log.p
logical; if TRUE, probabilities p are given as \(\mbox{log}(p)\).
lower.tail
whether to compute the lower tail. If false, we approximate the survival function.

Value

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

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 \le 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\).

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

See Also

the Gram Charlier expansions, dapx_gca, papx_gca

Examples

Run this code
# 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

Run the code above in your browser using DataLab