[R] Gram-Charlier CDF

From: Tolga Uzuner <tolga_at_coubros.com>
Date: Mon 13 Feb 2006 - 08:38:22 EST


Hi there,

Does anyone have something better (read faster) than the following for the CDF of an A-type Gram-Charlier expansion ?

Many thanks in advance,
Tolga

fact <- function (x) gamma(1 + x)

gc <- function(w,skew=0,kurtosis=0)
# gram-charlier density
# to be positive, must respect the constraints:
# [-1.0493,1.0493] and [3,7] respectively
{
sapply(w,function(y)
dnorm(y)-
skew/fact(3)*drv(dnorm,y,3)+
kurtosis/fact(4)*drv(dnorm,y,4))
}

gcd <-function(w,skew=0,kurtosis=0)
# gram-charlier cdf

integrate(function(x) gc(x,skew,kurtosis),-Inf,w)$value



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Feb 13 08:41:21 2006

This archive was generated by hypermail 2.1.8 : Tue 14 Feb 2006 - 00:54:07 EST