View source: R/Approximations.R
pEdge | R Documentation |
Edgeworth approximation of the CDF using the first four moments.
pEdge(x, moments = c(0, 1, 0, 3), raw = TRUE, lower.tail = TRUE, log.p = FALSE)
x |
Vector of points to approximate the CDF in. |
moments |
The first four raw moments if |
raw |
When |
lower.tail |
Logical indicating if the probabilities are of the form |
log.p |
Logical indicating if the probabilities are given as |
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 Edgeworth approximation for the CDF of X
(F(x)
) is given by
\hat{F}_{E}(x) = \Phi(z) + \phi(z) (-\nu/6 h_2(z)- (3k\times h_3(z)+\gamma_3^2h_5(z))/72)
with h_2(z)=z^2-1
, h_3(z)=z^3-3z
, h_5(z)=z^5-10z^3+15z
and z=(x-\mu)/\sigma
.
See Section 6.2 of Albrecher et al. (2017) for more details.
Vector of estimates for the probabilities F(x)=P(X\le x)
.
Tom Reynkens
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.
pGC
, pEdge
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.