public void TestSomeData() { StatisticalMoments sm = new StatisticalMoments(); for (int i = 0; i < 10; i++) { sm.Accumulate(i); } Assert.AreEqual(10, sm.Count()); Assert.AreEqual(4.5, sm.Average()); Assert.AreEqual(82.5, sm.UnnormalizedVariance()); Assert.Greater(9.16667, sm.Variance()); Assert.Less(9.16666, sm.Variance()); Assert.AreEqual(0, sm.Skewness()); Assert.Greater(-1.19, sm.Kurtosis()); Assert.Less(-1.2, sm.Kurtosis()); }
public void TestZeros() { StatisticalMoments sm = new StatisticalMoments(); for (int i = 0; i < 5; i++) { sm.Accumulate(0); } Assert.AreEqual(5, sm.Count()); Assert.AreEqual(0, sm.Average()); Assert.AreEqual(0, sm.UnnormalizedVariance()); Assert.AreEqual(0, sm.Variance()); Assert.IsNaN(sm.Skewness()); // must be NaN if variance is 0 Assert.IsNaN(sm.Kurtosis()); // must be NaN if variance is 0 }
public void TestEmptyNaN() { StatisticalMoments sm = new StatisticalMoments(); Assert.AreEqual(0, sm.Count()); Assert.AreEqual(0, sm.Average()); Assert.AreEqual(0, sm.UnnormalizedVariance()); Assert.IsNaN(sm.Variance()); Assert.IsNaN(sm.Skewness()); Assert.IsNaN(sm.Kurtosis()); }