Hello,
I tested your IterativeMoments library against non-iterative calculations in Scipy, and found a discrepancy for the 4th order (Kurtosis):
import openturns as ot
import scipy.stats as stats
import numpy as np
np.random.seed(1234)
# generate 100 random numbers from normal distribution
sample = np.random.normal(0, 1, 500)
mean = np.mean(sample)
variance = np.var(sample,ddof=1)
skewness = stats.skew(sample, bias=False)
kurtosis = stats.kurtosis(sample, bias=False)
ot_iter = ot.IterativeMoments(4, 1)
for x in sample :
ot_iter.increment(ot.Point([x]))
print(f"Scipy: {kurtosis}, OpenTurns: {ot_iter.getKurtosis()[0]}")
Which prints
Scipy: 0.16621066135050455, OpenTurns: 3.1662106613504966
I have also implemented the same iterative higher moments method following https://arxiv.org/pdf/1510.04923.pdf, which is apparently the same reference shown in the OpenTurns source here, you can find our custom implementation here.
Our implementation yields identical results as OpenTurns (equally wrong :-) ).
Hello,
I tested your IterativeMoments library against non-iterative calculations in Scipy, and found a discrepancy for the 4th order (Kurtosis):
Which prints
I have also implemented the same iterative higher moments method following https://arxiv.org/pdf/1510.04923.pdf, which is apparently the same reference shown in the OpenTurns source here, you can find our custom implementation here.
Our implementation yields identical results as OpenTurns (equally wrong :-) ).