Library: | VaR |
See also: | VaRestMC VaRest |
Quantlet: | CornishFisher | |
Description: | Implements the Cornish-Fisher expansion for arbitrary orders. The algorithm is related, but not identical to, the algorithm "AS269" published in "Applied Statistics". |
Usage: | x = CornishFisher(z,n,cum) | |
Input: | ||
z | scalar, the standard normal quantile | |
n | scalar, order of expansion; uses n+2 cumulants | |
cum | n x 1 vector of cumulants; cum[1] = mean, cum[2] = variance, ... | |
Output: | ||
x | the approximation to the cdfn(z)-quantile |
library("VaR") proc() = CFexample() z = 2.3 N = 8 cum = 1:(N+2) i = 2 r = matrix(N-1,2) while(i <= N) r[i-1,1] = i r[i-1,2] = CornishFisher(z,i,cum) i = i+1 endo r endp CFexample()
Contents of r [1,] 2 4.2527 [2,] 3 5.3252 [3,] 4 5.0684 [4,] 5 5.2169 [5,] 6 5.1299 [6,] 7 5.1415 [7,] 8 5.255