/** * For this distribution, {@code X}, this method returns * {@code P(x0 <= X <= x1)}. * This probability is computed by summing the point probabilities for the * values {@code x0, x0 + 1, x0 + 2, ..., x1}, in the order directed by * {@code dx}. * * @param x0 Inclusive lower bound. * @param x1 Inclusive upper bound. * @param dx Direction of summation (1 indicates summing from x0 to x1, and * 0 indicates summing from x1 to x0). * @return {@code P(x0 <= X <= x1)}. */ private double innerCumulativeProbability(int x0, int x1, int dx) { double ret = probability(x0); while (x0 != x1) { x0 += dx; ret += probability(x0); } return ret; }
/** * For this distribution, {@code X}, this method returns * {@code P(x0 <= X <= x1)}. * This probability is computed by summing the point probabilities for the * values {@code x0, x0 + 1, x0 + 2, ..., x1}, in the order directed by * {@code dx}. * * @param x0 Inclusive lower bound. * @param x1 Inclusive upper bound. * @param dx Direction of summation (1 indicates summing from x0 to x1, and * 0 indicates summing from x1 to x0). * @return {@code P(x0 <= X <= x1)}. */ private double innerCumulativeProbability(int x0, int x1, int dx) { double ret = probability(x0); while (x0 != x1) { x0 += dx; ret += probability(x0); } return ret; }
/** * For this distribution, {@code X}, this method returns * {@code P(x0 <= X <= x1)}. * This probability is computed by summing the point probabilities for the * values {@code x0, x0 + 1, x0 + 2, ..., x1}, in the order directed by * {@code dx}. * * @param x0 Inclusive lower bound. * @param x1 Inclusive upper bound. * @param dx Direction of summation (1 indicates summing from x0 to x1, and * 0 indicates summing from x1 to x0). * @return {@code P(x0 <= X <= x1)}. */ private double innerCumulativeProbability(int x0, int x1, int dx) { double ret = probability(x0); while (x0 != x1) { x0 += dx; ret += probability(x0); } return ret; }
double pCutoff = dist.probability(table[0][0]) * REL_ERR; double pValuePiece = dist.probability(i);
@Override public final void compute() { if (input[0].isDefined() && input[1].isDefined() && input[2].isDefined()) { int param = (int) Math.round(a.getDouble()); int param2 = (int) Math.round(b.getDouble()); int param3 = (int) Math.round(c.getDouble()); int val = (int) Math.round(d.getDouble()); try { HypergeometricDistribution dist = getHypergeometricDistribution( param, param2, param3); if (isCumulative.getBoolean()) { num.setValue(dist.cumulativeProbability(val)); // P(X <= // val) } else { num.setValue(dist.probability(val)); // P(X = val) } } catch (Exception e) { num.setUndefined(); } } else { num.setUndefined(); } }