Learn R Programming

PDQutils (version 0.1.6)

AS269: Higher order Cornish Fisher approximation.

Description

Lee and Lin's Algorithm AS269 for higher order Cornish Fisher quantile approximation.

Usage

AS269(z,cumul,order.max=NULL,all.ords=FALSE)

Arguments

z
the quantiles of the normal distribution. an atomic vector.
cumul
the standardized cumulants of order 3, 4, ..., k. an atomic vector.
order.max
the maximum order approximation, must be greater than length(cumul)+2. We assume the cumulants have been adjusted to reflect that the random variable has unit variance ('standardized cumulants')
all.ords
a logical value. If TRUE, then results are returned as a matrix, with a column for each order of the approximation. Otherwise the results are a matrix with a single column of the highest order approximation.

Value

A matrix, which is, depending on all.ords, either with one column per order of the approximation, or a single column giving the maximum order approximation. There is one row per value in z. Invalid arguments will result in return value NaN with a warning.

Details

The Cornish Fisher approximation is the Legendre inversion of the Edgeworth expansion of a distribution, but ordered in a way that is convenient when used on the mean of a number of independent draws of a random variable. Suppose \(x_1, x_2, \ldots, x_n\) are \(n\) independent draws from some probability distribution. Letting $$X = \frac{1}{\sqrt{n}} \sum_{1 \le i \le n} x_i,$$ the Central Limit Theorem assures us that, assuming finite variance, $$X \rightarrow \mathcal{N}(\sqrt{n}\mu, \sigma),$$ with convergence in \(n\). The Cornish Fisher approximation gives a more detailed picture of the quantiles of \(X\), one that is arranged in decreasing powers of \(\sqrt{n}\). The quantile function is the function \(q(p)\) such that \(P\left(X \le q(p)\right) = q(p)\). The Cornish Fisher expansion is $$q(p) = \sqrt{n}\mu + \sigma \left(z + \sum_{3 \le j} c_j f_j(z)\right),$$ where \(z = \Phi^{-1}(p)\), and \(c_j\) involves standardized cumulants of the distribution of \(x_i\) of order up to \(j\). Moreover, the \(c_j\) include decreasing powers of \(\sqrt{n}\), giving some justification for truncation. When \(n=1\), however, the ordering is somewhat arbitrary.

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

qapx_cf

Examples

Run this code
foo <- AS269(seq(-2,2,0.01),c(0,2,0,4))
# test with the normal distribution:
s.cumul <- c(0,0,0,0,0,0,0,0,0)
pv <- seq(0.001,0.999,0.001)
zv <- qnorm(pv)
apq <- AS269(zv,s.cumul,all.ords=FALSE)
err <- zv - apq

# test with the exponential distribution
rate <- 0.7
n <- 18
# these are 'raw' cumulants'
cumul <- (rate ^ -(1:n)) * factorial(0:(n-1))
# standardize and chop
s.cumul <- cumul[3:length(cumul)] / (cumul[2]^((3:length(cumul))/2))
pv <- seq(0.001,0.999,0.001)
zv <- qnorm(pv)
apq <- cumul[1] + sqrt(cumul[2]) * AS269(zv,s.cumul,all.ords=TRUE)
truq <- qexp(pv, rate=rate)
err <- truq - apq
colSums(abs(err))

# an example from Wikipedia page on CF, 
# \url{https://en.wikipedia.org/wiki/Cornish%E2%80%93Fisher_expansion}
s.cumul <- c(5,2)
apq <- 10 + sqrt(25) * AS269(qnorm(0.95),s.cumul,all.ords=TRUE)

Run the code above in your browser using DataLab