当前位置: 首页>>代码示例>>Java>>正文


Java SummaryStatistics.getSumsq方法代码示例

本文整理汇总了Java中org.apache.commons.math3.stat.descriptive.SummaryStatistics.getSumsq方法的典型用法代码示例。如果您正苦于以下问题:Java SummaryStatistics.getSumsq方法的具体用法?Java SummaryStatistics.getSumsq怎么用?Java SummaryStatistics.getSumsq使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.math3.stat.descriptive.SummaryStatistics的用法示例。


在下文中一共展示了SummaryStatistics.getSumsq方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStats

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
private static Stats getStats(FloatColumn values, SummaryStatistics summaryStatistics) {
    Stats stats = new Stats("Column: " + values.name());
    stats.min = (float) summaryStatistics.getMin();
    stats.max = (float) summaryStatistics.getMax();
    stats.n = summaryStatistics.getN();
    stats.sum = summaryStatistics.getSum();
    stats.variance = summaryStatistics.getVariance();
    stats.populationVariance = summaryStatistics.getPopulationVariance();
    stats.quadraticMean = summaryStatistics.getQuadraticMean();
    stats.geometricMean = summaryStatistics.getGeometricMean();
    stats.mean = summaryStatistics.getMean();
    stats.standardDeviation = summaryStatistics.getStandardDeviation();
    stats.sumOfLogs = summaryStatistics.getSumOfLogs();
    stats.sumOfSquares = summaryStatistics.getSumsq();
    stats.secondMoment = summaryStatistics.getSecondMoment();
    return stats;
}
 
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:18,代码来源:Stats.java

示例2: anovaStats

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
/**
 * This method actually does the calculations (except P-value).
 *
 * @param categoryData <code>Collection</code> of <code>double[]</code>
 * arrays each containing data for one category
 * @param allowOneElementData if true, allow computation for one catagory
 * only or for one data element per category
 * @return computed AnovaStats
 * @throws NullArgumentException if <code>categoryData</code> is <code>null</code>
 * @throws DimensionMismatchException if <code>allowOneElementData</code> is false and the number of
 * categories is less than 2 or a contained SummaryStatistics does not contain
 * at least two values
 */
private AnovaStats anovaStats(final Collection<SummaryStatistics> categoryData,
                              final boolean allowOneElementData)
    throws NullArgumentException, DimensionMismatchException {

    MathUtils.checkNotNull(categoryData);

    if (!allowOneElementData) {
        // check if we have enough categories
        if (categoryData.size() < 2) {
            throw new DimensionMismatchException(LocalizedFormats.TWO_OR_MORE_CATEGORIES_REQUIRED,
                                                 categoryData.size(), 2);
        }

        // check if each category has enough data
        for (final SummaryStatistics array : categoryData) {
            if (array.getN() <= 1) {
                throw new DimensionMismatchException(LocalizedFormats.TWO_OR_MORE_VALUES_IN_CATEGORY_REQUIRED,
                                                     (int) array.getN(), 2);
            }
        }
    }

    int dfwg = 0;
    double sswg = 0;
    double totsum = 0;
    double totsumsq = 0;
    int totnum = 0;

    for (final SummaryStatistics data : categoryData) {

        final double sum = data.getSum();
        final double sumsq = data.getSumsq();
        final int num = (int) data.getN();
        totnum += num;
        totsum += sum;
        totsumsq += sumsq;

        dfwg += num - 1;
        final double ss = sumsq - ((sum * sum) / num);
        sswg += ss;
    }

    final double sst = totsumsq - ((totsum * totsum) / totnum);
    final double ssbg = sst - sswg;
    final int dfbg = categoryData.size() - 1;
    final double msbg = ssbg / dfbg;
    final double mswg = sswg / dfwg;
    final double F = msbg / mswg;

    return new AnovaStats(dfbg, dfwg, F);

}
 
开发者ID:biocompibens,项目名称:SME,代码行数:66,代码来源:OneWayAnova.java


注:本文中的org.apache.commons.math3.stat.descriptive.SummaryStatistics.getSumsq方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。