+-
Java-使用Apache Commons计算偏度和峰度
我在向量中有数据点,我想计算数据集的偏度和峰度.

我该如何使用apache commons?

Vector<Double> mydata = new Vector<Double>
//data points are added by my routing

我在文档中找到的代码如下:

    FourthMoment m4 = new FourthMoment();
    Mean m = new Mean(m4);
    Variance v = new Variance(m4);
    Skewness s= new Skewness(m4);
    Kurtosis k = new Kurtosis(m4);
    assertEquals(var,v.getResult(),tolerance);
    assertEquals(skew ,s.getResult(),tolerance);

但是我的编译器无法识别Fourthmoment.以及实际上如何在其中获取mydata?

感谢您的帮助,我似乎无法获得清晰的示例.

我使用版本3.1.1,它可以识别我的所有导入内容,但第一个除外:

import org.apache.commons.math3.stat.descriptive.moment.FourthMoment;
import org.apache.commons.math3.stat.descriptive.moment.Kurtosis;
import org.apache.commons.math3.stat.descriptive.moment.Mean;
import org.apache.commons.math3.stat.descriptive.moment.Skewness;
import org.apache.commons.math3.stat.descriptive.moment.Variance;
最佳答案

do I need this fourth moment? Or can I just calculate it based on my vector?

我认为您可以使用Kurtosis.evaluate()直接进行计算.

点击查看更多相关文章

转载注明原文:Java-使用Apache Commons计算偏度和峰度 - 乐贴网