@Override
 public void processingFinished() {
   StandardDeviation standardDeviation = new StandardDeviation();
   List<Float> pitchValuesList = getPitchValues();
   double[] pitchValues = new double[pitchValuesList.size()];
   for (int i = 0; i < pitchValues.length; i++) {
     pitchValues[i] = pitchValuesList.get(i);
   }
   setFeatureValues(new float[] {(float) standardDeviation.evaluate(pitchValues)});
   reset();
 }
コード例 #2
0
  @Test
  public void testResults() throws InterruptedException {
    TaskUtil.run(d_model.getActivityTask());

    assertTrue(d_model.isReady());

    final InconsistencyParameter w =
        new InconsistencyParameter(Arrays.asList(d_ta, d_tb, d_tc, d_ta));
    assertEquals(Collections.singletonList(w), d_model.getInconsistencyFactors());

    double[] dAB =
        ResultsUtil.getSamples(d_model.getResults(), d_model.getRelativeEffect(d_ta, d_tb), 3);
    double[] dBC =
        ResultsUtil.getSamples(d_model.getResults(), d_model.getRelativeEffect(d_tb, d_tc), 3);
    double[] wABC = ResultsUtil.getSamples(d_model.getResults(), w, 3);

    // Values below obtained via a run through regular JAGS with 30k/20k
    // iterations. Taking .15 sd as acceptable margin (same as JAGS does
    // for testing against WinBUGS results).
    double mAB = 0.4713884;
    double sAB = 0.4838365;
    assertEquals(mAB, d_mean.evaluate(dAB), FACTOR * sAB);
    assertEquals(sAB, d_stdDev.evaluate(dAB), FACTOR * sAB);
    double mBC = -0.4645146;
    double sBC = 0.6111192;
    assertEquals(mBC, d_mean.evaluate(dBC), FACTOR * sBC);
    assertEquals(sBC, d_stdDev.evaluate(dBC), FACTOR * sBC);
    double mABC = -0.1466253;
    double sABC = 0.4568596;
    assertEquals(mABC, d_mean.evaluate(wABC), FACTOR * sABC);
    assertEquals(sABC, d_stdDev.evaluate(wABC), FACTOR * sABC);

    double[] dBA =
        ResultsUtil.getSamples(d_model.getResults(), d_model.getRelativeEffect(d_tb, d_ta), 3);
    assertEquals(-mAB, d_mean.evaluate(dBA), FACTOR * sAB);
    assertEquals(sAB, d_stdDev.evaluate(dBA), FACTOR * sAB);

    double[] dAC =
        ResultsUtil.getSamples(d_model.getResults(), d_model.getRelativeEffect(d_ta, d_tc), 3);
    double mAC = 0.1534991;
    double sAC = 0.5514409;
    assertEquals(mAC, d_mean.evaluate(dAC), FACTOR * sAC);
    assertEquals(sAC, d_stdDev.evaluate(dAC), FACTOR * sAC);
  }
コード例 #3
0
 public static double standardDeviation(Double[] residuals) {
   double[] primitiveResiduals = ArrayUtils.toPrimitive(residuals);
   StandardDeviation standardDeviation = new StandardDeviation();
   return standardDeviation.evaluate(primitiveResiduals);
 }
コード例 #4
0
ファイル: StatisticsUtility.java プロジェクト: jaywarrick/JEX
 public static Double stdDev(double[] values) {
   StandardDeviation stdevCalculator = new StandardDeviation();
   return stdevCalculator.evaluate(values);
 }
コード例 #5
0
ファイル: Irm3PL.java プロジェクト: jacobxk/psychometrics
 /**
  * Mean/sigma linking coefficients are computed from the mean and standard deviation of item
  * difficulty. The summary statistics are computed in a storeless manner. This method allows for
  * the incremental update to item difficulty summary statistics by combining them with other
  * summary statistics.
  *
  * @param mean item difficulty mean.
  * @param sd item difficulty standard deviation.
  */
 public void incrementMeanSigma(Mean mean, StandardDeviation sd) {
   mean.increment(difficulty);
   sd.increment(difficulty);
 }