cern.jet.random.Normal.cdf()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(132)

本文整理了Java中cern.jet.random.Normal.cdf()方法的一些代码示例,展示了Normal.cdf()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Normal.cdf()方法的具体详情如下:
包路径:cern.jet.random.Normal
类名称:Normal
方法名:cdf

Normal.cdf介绍

[英]Returns the cumulative distribution function.
[中]返回累积分布函数。

代码示例

代码示例来源:origin: cmu-phil/tetrad

double cdfResult = n.cdf(mid);

代码示例来源:origin: cmu-phil/tetrad

double idealValue = idealDistribution.cdf(x);

代码示例来源:origin: cmu-phil/tetrad

/**
 * Calculates the Cramer-von-Mises statistic for a variable
 *
 * @param dataSet relevant data set
 * @param variable continuous variable whose normality is in question
 *
 * @return Cramer-von-Mises statistic
 */
public static double cramerVonMises(DataSet dataSet, ContinuousVariable variable)
{
  int n = dataSet.getNumRows();
  int columnIndex = dataSet.getColumn(variable);
  Normal idealDistribution = getNormal(dataSet, variable);
  double cvmStatistic = 0.0;
  for (int i = 1; i <= n; i++)
  {
    double summedTerm = (((2 * i) - 1) / (2 * n)) - idealDistribution.cdf(dataSet.getDouble(i - 1, columnIndex));
    summedTerm *= summedTerm;
    cvmStatistic += summedTerm;
  }
  cvmStatistic += 1 / (12 * n);
  cvmStatistic /= n;
  return cvmStatistic;
}

代码示例来源:origin: uk.ac.ebi.pride.spectracluster/spectra-cluster

public double assessSimilarityAsPValue(IPeakMatches peakMatches) {
  // if there are no shared peaks, return 1 to indicate that it's random
  if (peakMatches.getNumberOfSharedPeaks() < 1)
    return 1;
  // only use the intensities
  double[] intensitiesSpec1 = extractPeakIntensities(peakMatches.getSharedPeaksFromSpectrumOne());
  double[] intensitiesSpec2 = extractPeakIntensities(peakMatches.getSharedPeaksFromSpectrumTwo());
  double correlation = kendallsCorrelation.correlation(intensitiesSpec1, intensitiesSpec2);
  // if the correlation cannot be calculated, assume that there is none
  if (Double.isNaN(correlation)) {
    return 1;
  }
  // convert correlation into probability using the distribution used in Peptidome
  // Normal Distribution with mean = 0 and SD^2 = 2(2k + 5)/9k(k − 1)
  double k = (double) peakMatches.getNumberOfSharedPeaks();
  // this cannot be calculated for only 1 shared peak
  if (k == 1)
    return 1;
  double sdSquare = (2 * (2 * k + 5)) / (9 * k * (k - 1) );
  double sd = Math.sqrt(sdSquare);
  Normal normal = new Normal(0, sd, randomEngine);
  double probability = normal.cdf(correlation);
  return 1 - probability;
}

相关文章

微信公众号

最新文章

更多