Code covered by the BSD License  

Highlights from
Exercises in Advanced Risk and Portfolio Management

from Exercises in Advanced Risk and Portfolio Management by Attilio Meucci
text and comments on solutions available at http://symmys.com/node/170

[ga,mu]=SummStats(X,N)
function [ga,mu]=SummStats(X,N)

% compute central moments
mu=zeros(1,N);
mu(1)=mean(X);
for n=2:N
    mu(n)=moment(X,n);
end

% compute standardized statistics 
ga=mu;
ga(2)=sqrt(mu(2));
for n=3:N
    ga(n)=mu(n)/(ga(2)^n);
end


Contact us at files@mathworks.com