View source: R/Approximations.R
pClas | R Documentation |
Compute approximations of the CDF using the normal approximation, normal-power approximation, shifted Gamma approximation or normal approximation to the shifted Gamma distribution.
pClas(x, mean = 0, variance = 1, skewness = NULL,
method = c("normal", "normal-power", "shifted Gamma", "shifted Gamma normal"),
lower.tail = TRUE, log.p = FALSE)
x |
Vector of points to approximate the CDF in. |
mean |
Mean of the distribution, default is 0. |
variance |
Variance of the distribution, default is 1. |
skewness |
Skewness coefficient of the distribution, this argument is not used for the normal approximation. Default is |
method |
Approximation method to use, one of |
lower.tail |
Logical indicating if the probabilities are of the form |
log.p |
Logical indicating if the probabilities are given as |
The normal approximation for the CDF of the r.v. X
is defined as
F_X(x) \approx \Phi((x-\mu)/\sigma)
where \mu
and \sigma^2
are the mean and variance of X
, respectively.
This approximation can be improved when the skewness parameter
\nu=E((X-\mu)^3)/\sigma^3
is available. The normal-power approximation of the CDF is then given by
F_X(x) \approx \Phi(\sqrt{9/\nu^2 + 6z/\nu+1}-3/\nu)
for z=(x-\mu)/\sigma\ge 1
and 9/\nu^2 + 6z/\nu+1\ge 0
.
The shifted Gamma approximation uses the approximation
X \approx \Gamma(4/\nu^2, 2/(\nu\times\sigma)) + \mu -2\sigma/\nu.
Here, we need that \nu>0
.
The normal approximation to the shifted Gamma distribution approximates the CDF of X
as
F_X(x) \approx \Phi(\sqrt{16/\nu^2 + 8z/\nu}-\sqrt{16/\nu^2-1})
for z=(x-\mu)/\sigma\ge 1
. We need again that \nu>0
.
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.
pEdge
, pGC
# Chi-squared sample
X <- rchisq(1000, 2)
x <- seq(0, 10, 0.01)
# Classical approximations
p1 <- pClas(x, mean(X), var(X))
p2 <- pClas(x, mean(X), var(X), mean((X-mean(X))^3)/sd(X)^3, method="normal-power")
p3 <- pClas(x, mean(X), var(X), mean((X-mean(X))^3)/sd(X)^3, method="shifted Gamma")
p4 <- pClas(x, mean(X), var(X), mean((X-mean(X))^3)/sd(X)^3, method="shifted Gamma normal")
# 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, col="green")
lines(x, p3, lty=4)
lines(x, p4, lty=5, col="blue")
legend("bottomright", c("True CDF", "normal approximation", "normal-power approximation",
"shifted Gamma approximation", "shifted Gamma normal approximation"),
lty=1:5, col=c("red", "black", "green", "black", "blue"), lwd=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.