Univariate 4th-order Gram-Charlier density approximation.

dgc4(x, cmom, rm.neg = TRUE, log = FALSE)

Arguments

x

Vector of density quantiles.

cmom

Vector of first 4 central moments of distribution.

rm.neg

Logical; if TRUE clips the density at smallest calculated non-negative value.

log

Logical; if TRUE returns approximating density on log scale.

Value

Vector of density evaluations.

Examples

df <- 3 nsamples <- 100 X <- rchisq(nsamples, df=df) # iid samples from the Chi-Sq(df) # calculate central moments cmom <- mean(X) cmom <- c(cmom, mean((X-cmom)^2), mean((X-cmom)^3), mean((X-cmom)^4)) curve(dgc4(x, cmom = cmom, rm.neg = TRUE), from = 0, to = 10)