CornishFisher: Cornish-Fisher expansion

dCornishFisherR Documentation

Cornish-Fisher expansion

Description

Density, distribution function, quantile function and random generation using Cornish-Fisher approximation.

Usage

dCornishFisher(x, n, skew, ekurt)

pCornishFisher(q, n, skew, ekurt)

qCornishFisher(p, n, skew, ekurt)

rCornishFisher(n, sigma, skew, ekurt, dp = NULL, seed = NULL)

Arguments

x, q

vector of standardized quantiles.

n

scalar; number of simulated values in random simulation, sample length in density, distribution and quantile functions.

skew

scalar; skewness.

ekurt

scalar; excess kurtosis.

p

vector of probabilities.

sigma

scalar standard deviation.

dp

a vector of length 3, whose elements represent sigma, skew and ekurt, respectively. If dp is specified, the individual parameters cannot be set. Default is NULL.

seed

scalar; set seed. Default is NULL.

Details

CDF(q) = Pr(sqrt(n)*(x_bar-mu)/sigma < q) dCornishFisher Computes Cornish-Fisher density from two term Edgeworth expansion given mean, standard deviation, skewness and excess kurtosis. pCornishFisher Computes Cornish-Fisher CDF from two term Edgeworth expansion given mean, standard deviation, skewness and excess kurtosis. qCornishFisher Computes Cornish-Fisher quantiles from two term Edgeworth expansion given mean, standard deviation, skewness and excess kurtosis. rCornishFisher simulates observations based on Cornish-Fisher quantile expansion given mean, standard deviation, skewness and excess kurtosis.

Value

dCornishFisher gives the density, pCornishFisher gives the distribution function, qCornishFisher gives the quantile function, and rCornishFisher generates n random simulations.

Author(s)

Eric Zivot and Yi-An Chen.

References

DasGupta, A. (2008). Asymptotic theory of statistics and probability. Springer. Severini, T. A., (2000). Likelihood Methods in Statistics. Oxford University Press.

Examples

## Not run: 
# generate 1000 observation from Cornish-Fisher distribution
rc <- rCornishFisher(1000,1,0,5)
hist(rc, breaks=100, freq=FALSE, 
     main="simulation of Cornish Fisher Distribution", xlim=c(-10,10))
lines(seq(-10,10,0.1), dnorm(seq(-10,10,0.1), mean=0, sd=1), col=2)
# compare with standard normal curve

# exponential example from A.dasGupta p.188
# x is iid exp(1) distribution, sample size = 5
# then x_bar is Gamma(shape=5, scale=1/5) distribution
q <- c(0,0.4,1,2)
# exact cdf
pgamma(q/sqrt(5)+1, shape=5, scale=1/5)
# use CLT
pnorm(q)
# use edgeworth expansion
pCornishFisher(q, n=5, skew=2, ekurt=6)

## End(Not run)


braverock/factorAnalytics documentation built on Dec. 16, 2024, 1:05 p.m.