/** {@inheritDoc} */ public double cumulativeProbability(int x) { double ret; int[] domain = getDomain(populationSize, numberOfSuccesses, sampleSize); if (x < domain[0]) { ret = 0.0; } else if (x >= domain[1]) { ret = 1.0; } else { ret = innerCumulativeProbability(domain[0], x, 1); } return ret; }
/** * For this distribution, {@code X}, this method returns {@code P(X >= x)}. * * @param x Value at which the CDF is evaluated. * @return the upper tail CDF for this distribution. * @since 1.1 */ public double upperCumulativeProbability(int x) { double ret; final int[] domain = getDomain(populationSize, numberOfSuccesses, sampleSize); if (x <= domain[0]) { ret = 1.0; } else if (x > domain[1]) { ret = 0.0; } else { ret = innerCumulativeProbability(domain[1], x, -1); } return ret; }
/** {@inheritDoc} */ @Override public double logProbability(int x) { double ret; int[] domain = getDomain(populationSize, numberOfSuccesses, sampleSize); if (x < domain[0] || x > domain[1]) { ret = Double.NEGATIVE_INFINITY; } else { double p = (double) sampleSize / (double) populationSize; double q = (double) (populationSize - sampleSize) / (double) populationSize; double p1 = SaddlePointExpansion.logBinomialProbability(x, numberOfSuccesses, p, q); double p2 = SaddlePointExpansion.logBinomialProbability(sampleSize - x, populationSize - numberOfSuccesses, p, q); double p3 = SaddlePointExpansion.logBinomialProbability(sampleSize, populationSize, p, q); ret = p1 + p2 - p3; } return ret; }
/** {@inheritDoc} */ public double cumulativeProbability(int x) { double ret; int[] domain = getDomain(populationSize, numberOfSuccesses, sampleSize); if (x < domain[0]) { ret = 0.0; } else if (x >= domain[1]) { ret = 1.0; } else { ret = innerCumulativeProbability(domain[0], x, 1); } return ret; }
/** {@inheritDoc} */ public double cumulativeProbability(int x) { double ret; int[] domain = getDomain(populationSize, numberOfSuccesses, sampleSize); if (x < domain[0]) { ret = 0.0; } else if (x >= domain[1]) { ret = 1.0; } else { ret = innerCumulativeProbability(domain[0], x, 1); } return ret; }
/** * For this distribution, {@code X}, this method returns {@code P(X >= x)}. * * @param x Value at which the CDF is evaluated. * @return the upper tail CDF for this distribution. * @since 1.1 */ public double upperCumulativeProbability(int x) { double ret; final int[] domain = getDomain(populationSize, numberOfSuccesses, sampleSize); if (x <= domain[0]) { ret = 1.0; } else if (x > domain[1]) { ret = 0.0; } else { ret = innerCumulativeProbability(domain[1], x, -1); } return ret; }
/** * For this distribution, {@code X}, this method returns {@code P(X >= x)}. * * @param x Value at which the CDF is evaluated. * @return the upper tail CDF for this distribution. * @since 1.1 */ public double upperCumulativeProbability(int x) { double ret; final int[] domain = getDomain(populationSize, numberOfSuccesses, sampleSize); if (x <= domain[0]) { ret = 1.0; } else if (x > domain[1]) { ret = 0.0; } else { ret = innerCumulativeProbability(domain[1], x, -1); } return ret; }
/** {@inheritDoc} */ @Override public double logProbability(int x) { double ret; int[] domain = getDomain(populationSize, numberOfSuccesses, sampleSize); if (x < domain[0] || x > domain[1]) { ret = Double.NEGATIVE_INFINITY; } else { double p = (double) sampleSize / (double) populationSize; double q = (double) (populationSize - sampleSize) / (double) populationSize; double p1 = SaddlePointExpansion.logBinomialProbability(x, numberOfSuccesses, p, q); double p2 = SaddlePointExpansion.logBinomialProbability(sampleSize - x, populationSize - numberOfSuccesses, p, q); double p3 = SaddlePointExpansion.logBinomialProbability(sampleSize, populationSize, p, q); ret = p1 + p2 - p3; } return ret; }
/** {@inheritDoc} */ @Override public double logProbability(int x) { double ret; int[] domain = getDomain(populationSize, numberOfSuccesses, sampleSize); if (x < domain[0] || x > domain[1]) { ret = Double.NEGATIVE_INFINITY; } else { double p = (double) sampleSize / (double) populationSize; double q = (double) (populationSize - sampleSize) / (double) populationSize; double p1 = SaddlePointExpansion.logBinomialProbability(x, numberOfSuccesses, p, q); double p2 = SaddlePointExpansion.logBinomialProbability(sampleSize - x, populationSize - numberOfSuccesses, p, q); double p3 = SaddlePointExpansion.logBinomialProbability(sampleSize, populationSize, p, q); ret = p1 + p2 - p3; } return ret; }