##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (w, mu, sigma, M3, M4, p)
{
skew = skewness.MM(w, sigma, M3)
exkurt = kurtosis.MM(w, sigma, M4) - 3
z = qnorm(1 - p)
h = z + (1/6) * (z^2 - 1) * skew
h = h + (1/24) * (z^3 - 3 * z) * exkurt - (1/36) * (2 * z^3 -
5 * z) * skew^2
return(-mean.MM(w, mu) - h * StdDev.MM(w, sigma))
}
Run the code above in your browser using DataLab