用apache commons计算偏度和峰度

时间:2013-04-05 14:41:02

标签: java math statistics 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;

1 个答案:

答案 0 :(得分:3)

  

我需要第四个时刻吗?或者我可以根据我的向量计算它?

我认为你可以使用Kurtosis.evaluate()直接计算它。