org.apache.commons.math3.stat.descriptive.rank.Percentile.withEstimationType()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(271)

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

Percentile.withEstimationType介绍

[英]Build a new instance similar to the current one except for the EstimationType.

This method is intended to be used as part of a fluent-type builder pattern. Building finely tune instances should be done as follows:

Percentile customized = new Percentile(quantile). 
withEstimationType(estimationType). 
withNaNStrategy(nanStrategy). 
withKthSelector(kthSelector);

If any of the withXxx method is omitted, the default value for the corresponding customization parameter will be used.
[中]构建一个与当前实例类似的新实例,但EstimationType除外。
此方法旨在用作fluent type builder模式的一部分。构建微调实例应按以下步骤进行:

Percentile customized = new Percentile(quantile). 
withEstimationType(estimationType). 
withNaNStrategy(nanStrategy). 
withKthSelector(kthSelector);

如果省略了withXxx方法中的任何一个,则将使用相应自定义参数的默认值。

代码示例

代码示例来源:origin: zavtech/morpheus-core

@Override
public double getValue() {
  return new org.apache.commons.math3.stat.descriptive.rank.Percentile(nth * 100)
    .withEstimationType(org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType.R_7)
    .withNaNStrategy(NaNStrategy.FIXED)
    .evaluate(values, 0, n);
}

代码示例来源:origin: automatictester/lightning

@Override
protected int calculateNumericResult(DescriptiveStatistics ds) {
  ds.setPercentileImpl(new Percentile().withEstimationType(Percentile.EstimationType.R_3));
  return actualResult = (int) ds.getPercentile((double) percentile);
}

代码示例来源:origin: meyerjp3/psychometrics

/**
 * Computes the bandwidth
 */
private void computeBandwidth(){
  double n = (double)x.length;
  stats = new DescriptiveStatistics(x);
  stats.setPercentileImpl(new Percentile().withEstimationType(Percentile.EstimationType.R_7));//Use the same percentile method as R.
  double observedSd = stats.getStandardDeviation();
  double observedQ1 = stats.getPercentile(25);
  double observedQ3 = stats.getPercentile(75);
  double observedIqr = observedQ3-observedQ1;
  if(bandwidthType==BandwidthType.BW_NRD){
    //Scott's plugin bandwidth (bw.nrd in R)
    h = 1.06*Math.min(observedSd, observedIqr/1.34)*Math.pow(n, -1.0/5.0);
  }else{
    //Silverman's rule of thumb (bw.nrd0 is the default in R and the default here.)
    h = 0.9*Math.min(observedSd, observedIqr/1.34)*Math.pow(n, -1.0/5.0);
  }
  //apply adjustment factor
  h *= adjust;
}

相关文章