Package org.apache.commons.math3.distribution

Examples of org.apache.commons.math3.distribution.BinomialDistribution.probability()


                    int criticalValueLow = 0;
                    int criticalValueHigh = numberOfTrials;
                    double pTotal = 0;

                    while (true) {
                        double pLow = distribution.probability(criticalValueLow);
                        double pHigh = distribution.probability(criticalValueHigh);

                        if (pLow == pHigh) {
                            pTotal += 2 * pLow;
                            criticalValueLow++;
View Full Code Here


                    int criticalValueHigh = numberOfTrials;
                    double pTotal = 0;

                    while (true) {
                        double pLow = distribution.probability(criticalValueLow);
                        double pHigh = distribution.probability(criticalValueHigh);

                        if (pLow == pHigh) {
                            pTotal += 2 * pLow;
                            criticalValueLow++;
                            criticalValueHigh--;
View Full Code Here

                int c_xj = idPWM.getMatrix()[i][j]; // count of residue at position j
                double p_xj = ((double) bGPWM.getMatrix()[i][j])/((double) bGPWM.getColumnSum(j));
                double bin_prob = 0.00;
                for(int trial = c_xj; trial <= m; trial++){
                    BinomialDistribution bnDistr = new BinomialDistribution(trial,p_xj);
                    bin_prob = bin_prob + bnDistr.probability(trial);
                    //int printbin = (m - c_xj)/20;
                    if(trial%10==0){
                        System.out.println("\t\t\tBinomial probability of "+ aminoA_symbols[i] + ", " +
                                relative_positions[j] + " at iteration " + trial + " of " + m + " is " +
                                   bin_prob);
View Full Code Here

    IntegerDistribution ref = new PoissonDistribution(RandomUtils.getRandom().getRandomGenerator(),
                                                      alpha,
                                                      PoissonDistribution.DEFAULT_EPSILON,
                                                      PoissonDistribution.DEFAULT_MAX_ITERATIONS);
    for (int i = 0; i < count.length; i++) {
      assertEquals(ref.probability(i), count[i] / 10000.0, 2.0e-2);
    }
  }
}
View Full Code Here

        for (int i = 0; i < len; i++) {
            observed[i] = f.getCount(i + 1);
        }
        final double[] expected = new double[len];
        for (int i = 0; i < len; i++) {
            expected[i] = poissonDistribution.probability(i + 1) * largeSampleSize;
        }
       
        TestUtils.assertChiSquareAccept(expected, observed, 0.0001);
    }

View Full Code Here

        for (int i = 0; i < len; i++) {
            observed[i] = f.getCount(i + 1);
        }
        final double[] expected = new double[len];
        for (int i = 0; i < len; i++) {
            expected[i] = poissonDistribution.probability(i + 1) * largeSampleSize;
        }
       
        TestUtils.assertChiSquareAccept(expected, observed, 0.0001);
    }

View Full Code Here

        for (int i = 0; i < len; i++) {
            observed[i] = f.getCount(i + 1);
        }
        final double[] expected = new double[len];
        for (int i = 0; i < len; i++) {
            expected[i] = poissonDistribution.probability(i + 1) * largeSampleSize;
        }
       
        TestUtils.assertChiSquareAccept(expected, observed, 0.0001);
    }

View Full Code Here

    IntegerDistribution ref = new PoissonDistribution(RandomUtils.getRandom().getRandomGenerator(),
                                                      alpha,
                                                      PoissonDistribution.DEFAULT_EPSILON,
                                                      PoissonDistribution.DEFAULT_MAX_ITERATIONS);
    for (int i = 0; i < count.length; i++) {
      assertEquals(ref.probability(i), count[i] / 10000.0, 2.0e-2);
    }
  }
}
View Full Code Here

    final Iterator<?> it = observations.valuesIterator();
    int index = 0;
    while (it.hasNext()) {
      final Long l = (Long) it.next();
      observed[index] = observations.getCount(l);
      expected[index] = pd.probability(l.intValue())
          * observations.getSumFreq();
      if (expected[index] == 0) {
        return false;
      }
      index++;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.