commons-math之常用科学计算(百分位、总体方差、中位数、变异系数、偏度系数、峰度系数)


import cn.hutool.core.util.NumberUtil;
import org.apache.commons.math3.stat.StatUtils;
import org.apache.commons.math3.stat.descriptive.moment.Kurtosis;
import org.apache.commons.math3.stat.descriptive.moment.Skewness;
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation;
import org.apache.commons.math3.stat.descriptive.rank.Median;

/**
 * 

* 简单的数据统计分析 *

* * @Author REID * @Blog https://blog.csdn.net/qq_39035773 * @GitHub https://github.com/BeginnerA * @Data 2021/8/10 * @Version V1.0 **/ public class MathTest { public static void main(String[] args){ double[] values = new double[] {3.35,6.54,2.21,5.522,4.522,5.64,3.45,2.522,2.88}; double[] values2 = new double[] {0.89,1.51,0.379,0.41,0.712,0.48,0.54,0.56,0.43}; //计数 System.out.println("计算样本个数为:" +values.length); //mean--算数平均数 System.out.println("平均数:" + StatUtils.mean(values)); //sum--和 System.out.println("所有数据相加结果为:" + StatUtils.sum(values)); //max--最小值 System.out.println("最小值:" + StatUtils.min(values)); //max--最大值 System.out.println("最大值:" + StatUtils.max(values)); //范围 System.out.println("范围是:" + (StatUtils.max(values)-StatUtils.min(values))); //variance--方差 System.out.println("一组数据的方差为:" + StatUtils.variance(values)); //mode--众数 double[] res = StatUtils.mode(values); System.out.println("众数:" + res[0]+","+res[1]); for(int i = 0;i

自定义函数计算公式

 1、几何标准差

commons-math之常用科学计算(百分位、总体方差、中位数、变异系数、偏度系数、峰度系数)_第1张图片

2、偏度系数

commons-math之常用科学计算(百分位、总体方差、中位数、变异系数、偏度系数、峰度系数)_第2张图片

3、峰度系数

commons-math之常用科学计算(百分位、总体方差、中位数、变异系数、偏度系数、峰度系数)_第3张图片

4、内罗梅指数/综合指数

 

相对数据库自定义函数实现数据库自定义聚合函数

你可能感兴趣的:(实用小工具,Java,几何学,概率论,线性代数,矩阵,拓扑学)