pGC: Gram-Charlier approximation

View source: R/Approximations.R

pGCR Documentation

Gram-Charlier approximation

Description

Gram-Charlier approximation of the CDF using the first four moments.

Usage

pGC(x, moments = c(0, 1, 0, 3), raw = TRUE, lower.tail = TRUE, log.p = FALSE)

Arguments

x

Vector of points to approximate the CDF in.

moments

The first four raw moments if raw=TRUE. By default the first four raw moments of the standard normal distribution are used. When raw=FALSE, the mean \mu=E(X), variance \sigma^2=E((X-\mu)^2), skewness (third standardised moment, \nu=E((X-\mu)^3)/\sigma^3) and kurtosis (fourth standardised moment, k=E((X-\mu)^4)/\sigma^4).

raw

When TRUE (default), the first four raw moments are provided in moments. Otherwise, the mean, variance, skewness and kurtosis are provided in moments.

lower.tail

Logical indicating if the probabilities are of the form P(X\le x) (TRUE) or P(X>x) (FALSE). Default is TRUE.

log.p

Logical indicating if the probabilities are given as \log(p), default is FALSE.

Details

Denote the standard normal PDF and CDF respectively by \phi and \Phi. Let \mu be the first moment, \sigma^2=E((X-\mu)^2) the variance, \mu_3=E((X-\mu)^3) the third central moment and \mu_4=E((X-\mu)^4) the fourth central moment of the random variable X. The corresponding cumulants are given by \kappa_1=\mu, \kappa_2=\sigma^2, \kappa_3=\mu_3 and \kappa_4=\mu_4-3\sigma^4.

Now consider the random variable Z=(X-\mu)/\sigma, which has cumulants 0, 1, \nu=\kappa_3/\sigma^3 and k=\kappa_4/\sigma^4=\mu_4/\sigma^4-3.

The Gram-Charlier approximation for the CDF of X (F(x)) is given by

\hat{F}_{GC}(x) = \Phi(z) + \phi(z) (-\nu/6 h_2(z)- k/24h_3(z))

with h_2(z)=z^2-1, h_3(z)=z^3-3z and z=(x-\mu)/\sigma.

See Section 6.2 of Albrecher et al. (2017) for more details.

Value

Vector of estimates for the probabilities F(x)=P(X\le x).

Author(s)

Tom Reynkens

References

Albrecher, H., Beirlant, J. and Teugels, J. (2017). Reinsurance: Actuarial and Statistical Aspects, Wiley, Chichester.

Cheah, P.K., Fraser, D.A.S. and Reid, N. (1993). "Some Alternatives to Edgeworth." The Canadian Journal of Statistics, 21(2), 131–138.

See Also

pEdge, pClas

Examples

# Chi-squared sample
X <- rchisq(1000, 2)


x <- seq(0, 10, 0.01)

# Empirical moments
moments = c(mean(X), mean(X^2), mean(X^3), mean(X^4))

# Gram-Charlier approximation
p1 <- pGC(x, moments)

# Edgeworth approximation
p2 <- pEdge(x, moments)

# Normal approximation
p3 <- pClas(x, mean(X), var(X))

# True probabilities
p <- pchisq(x, 2)


# Plot true and estimated probabilities
plot(x, p, type="l", ylab="F(x)", ylim=c(0,1), col="red")
lines(x, p1, lty=2)
lines(x, p2, lty=3)
lines(x, p3, lty=4, col="blue")

legend("bottomright", c("True CDF", "GC approximation", 
                        "Edgeworth approximation", "Normal approximation"), 
       col=c("red", "black", "black", "blue"), lty=1:4, lwd=2)

TReynkens/ReIns documentation built on Nov. 9, 2023, 1:29 p.m.