[R] sn package - skew t - code for analytical expressions for first 4 moments
Luc Hoegaerts
luc.hoegaerts at gmail.com
Thu Aug 10 12:00:28 CEST 2006
hello users of the SN package,
i thought i post here some useful help on R code on the 4 moments for the skew t
sampling gives seldom good results for skewness and kurtosis, so
one really needs the analytical results,
it took me some time to get it from the article
Azzalini, A. & Capitanio, A. (2003),
Distributions generated by perturbation of symmetry with emphasis on
a multivariate skew-t distribution.
hope it is one day useful for someone else too.
bye
luc
# computing analytical moments for skew t of azzalini
xi=location;
alpha=shape;
omega=sd(X);
delta=alpha/sqrt(1+alpha^2);
mu=delta*sqrt(df/pi)*gamma(0.5*(df-1))/gamma(0.5*df);
# the 4 first moments
moment1=xi+omega*mu;
moment2=xi^2 + 2*omega*mu*xi + omega^2 * df/(df-2);
moment3=xi^3 + 3*omega*mu*xi^2 + 3*omega^2*df/(df-2)*xi +
omega^3*mu*(3-delta^2)*df/(df-3);
moment4=xi^4 + 4*omega*mu*xi^3 + 6*omega^2*df/(df-2)*xi^2 +
4*omega^3*mu*(3-delta^2)*df/(df-3)*xi+omega^4*3*df^2/((df-2)*(df-4));
# the 4 useful measures
mean=moment1;
var=moment2;
skew=moment3/var^(3/2);
kurt=moment4/var^2 - 3;
More information about the R-help
mailing list