Am I right in thinking that the variance is the second moment and that the skewness is the third moment?
Here is the algorithm I used for variance and I wonder if simply summing ^3's rather than ^2's will give me the 3rd moment? I feel it should be quite easy but it's still rather beyond me.
mean_old = 0;
mean_new = 0;
sum = 0;
wgt_old = 0;
wgt_new = 0;
foreach x in data and w in weights:
wgt_new = wgt_old + w;
mean_new = (wgt_old*mean_old + w*x)/wgt_new;
sum = sum + wgt_old*mean_old^2 + w*x^2 - wgt_new*mean_new^2;
wgt_old = wgt_new;
mean_old = mean_new;
variance = sum/wgt_new;