/**
*
* @param Probability 累积概率
* @param degFreedom 自由度数
* @return 方分布的右尾概率的反函数值
*/
public static double getChiSqVal(double Probability, double degFreedom) {
//创建指定自由度的卡方分布,参数传入自由度数
ChiSquaredDistribution chiSquaredDistribution = new ChiSquaredDistribution(Double.valueOf(degFreedom));
if(Probability<1) {
//计算卡方分布的右尾概率的反函数值,参数(1-累积概率);卡方分布的左尾概率的反函数值,参数(累积概率)
double chiSquaredDistributionVal = chiSquaredDistribution.inverseCumulativeProbability(Double.valueOf(1-Probability));
//保留9位小数点
return chiSquaredDistributionVal;
}else {
return 0;
}
}