I want to calculate the first 4 raw moments of lists of data points, for example my_list = [34.0, 35.0, 39.0, 43.0, 46.5, 48.5, 50.0, 51.5, 52.5].
I am aware of scipy.stats.moment but seems it only calculates central moments:
scipy.stats.moment(a, moment=1, axis=0, nan_policy='propagate')
Calculate the nth moment about the mean for a sample.
A moment is a specific quantitative measure of the shape of a set of points. It is often used to calculate coefficients of skewness and kurtosis due to its close relationship with them.
I also notice there are scipy.stats functions for skewness or variance:
from scipy.stats import variation, skew
my_list = [34.0, 35.0, 39.0, 43.0, 46.5, 48.5, 50.0, 51.5, 52.5]
print(np.var(my_list))
print(variation(my_list))
print(skew(my_list))
>>> 44.0246913580247
>>> 0.14928998626833617
>>> -0.39001327934054053
but as you can see numpy and scipy return very different results.
What are the differences between these approaches and what's the most efficient way to find the first 4 raw moments(mean, variance, skewness, kurtosis)?