public final class IntervalUtils extends Object
Modifier and Type | Method and Description |
---|---|
static ConfidenceInterval |
getAgrestiCoullInterval(int numberOfTrials,
int numberOfSuccesses,
double confidenceLevel)
Create an Agresti-Coull binomial confidence interval for the true
probability of success of an unknown binomial distribution with the given
observed number of trials, successes and confidence level.
|
static ConfidenceInterval |
getClopperPearsonInterval(int numberOfTrials,
int numberOfSuccesses,
double confidenceLevel)
Create a Clopper-Pearson binomial confidence interval for the true
probability of success of an unknown binomial distribution with the given
observed number of trials, successes and confidence level.
|
static ConfidenceInterval |
getNormalApproximationInterval(int numberOfTrials,
int numberOfSuccesses,
double confidenceLevel)
Create a binomial confidence interval for the true probability of success
of an unknown binomial distribution with the given observed number of
trials, successes and confidence level using the Normal approximation to
the binomial distribution.
|
static ConfidenceInterval |
getWilsonScoreInterval(int numberOfTrials,
int numberOfSuccesses,
double confidenceLevel)
Create a Wilson score binomial confidence interval for the true
probability of success of an unknown binomial distribution with the given
observed number of trials, successes and confidence level.
|
public static ConfidenceInterval getAgrestiCoullInterval(int numberOfTrials, int numberOfSuccesses, double confidenceLevel)
numberOfTrials
- number of trialsnumberOfSuccesses
- number of successesconfidenceLevel
- desired probability that the true probability of
success falls within the returned intervalconfidenceLevel
NotStrictlyPositiveException
- if numberOfTrials <= 0
.NotPositiveException
- if numberOfSuccesses < 0
.NumberIsTooLargeException
- if numberOfSuccesses > numberOfTrials
.OutOfRangeException
- if confidenceLevel
is not in the interval (0, 1)
.public static ConfidenceInterval getClopperPearsonInterval(int numberOfTrials, int numberOfSuccesses, double confidenceLevel)
Preconditions:
numberOfTrials
must be positivenumberOfSuccesses
may not exceed numberOfTrials
confidenceLevel
must be strictly between 0 and 1 (exclusive)numberOfTrials
- number of trialsnumberOfSuccesses
- number of successesconfidenceLevel
- desired probability that the true probability of
success falls within the returned intervalconfidenceLevel
NotStrictlyPositiveException
- if numberOfTrials <= 0
.NotPositiveException
- if numberOfSuccesses < 0
.NumberIsTooLargeException
- if numberOfSuccesses > numberOfTrials
.OutOfRangeException
- if confidenceLevel
is not in the interval (0, 1)
.public static ConfidenceInterval getNormalApproximationInterval(int numberOfTrials, int numberOfSuccesses, double confidenceLevel)
numberOfTrials
- number of trialsnumberOfSuccesses
- number of successesconfidenceLevel
- desired probability that the true probability of
success falls within the intervalconfidenceLevel
public static ConfidenceInterval getWilsonScoreInterval(int numberOfTrials, int numberOfSuccesses, double confidenceLevel)
numberOfTrials
- number of trialsnumberOfSuccesses
- number of successesconfidenceLevel
- desired probability that the true probability of
success falls within the returned intervalconfidenceLevel
NotStrictlyPositiveException
- if numberOfTrials <= 0
.NotPositiveException
- if numberOfSuccesses < 0
.NumberIsTooLargeException
- if numberOfSuccesses > numberOfTrials
.OutOfRangeException
- if confidenceLevel
is not in the interval (0, 1)
.Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.