public class BinomialDist
extends java.lang.Object
Constructor and Description |
---|
BinomialDist(int noOfSamples,
double prob) |
Modifier and Type | Method and Description |
---|---|
static double |
erf(double z,
double accuracy)
Gauss error function (calculated using the Talyor expansion)
Note: The returned value has a big error about when z is greater than 4. |
static double |
erfInv(double v,
double accuracy) |
int |
getBinomialCoefficient(int k)
Returns the binomial coefficient indexed by the number of samples and k.
|
double |
getMean()
Calculate the mean of the binomial distribution.
|
int |
getNoOfSamples()
Returns the number of trials.
|
double |
getProb()
Returns success probability in each trial.
|
double |
getStdDev()
Calculate the standard deviation of the binomial distribution.
|
double |
getStdScore(double rawScore)
Calculate the standard score of the binomial distribution.
|
double |
getVariance()
Calculate the variance of the binomial distribution.
|
double |
lowerBoundNormal95()
Calculates the lower bound for a 95% confidence interval
i.e., the value above which 97.5% of sample take,
by normal approximation.
|
double |
lowerBoundNormal95Lower()
Calculates the lower bound for a 95% confidence interval, upper only
i.e., the value above which 95% of sample take,
by normal approximation.
|
double |
PMF(int k)
Returns the probability of getting exactly k successes.
|
double |
populationAbove(double lowerBound)
Calculates the population above a given lower Bound.
|
double |
populationBelow(double upperBound)
Calculates the population below a given upper Bound.
|
double |
populationBelowNormal(double upperBound)
Calculates the population below a given upper Bound
by using normal approximation.
|
double |
upperBoundNormal95()
Calculates the upper bound for a 95% confidence interval
i.e., the value below which 97.5% of sample take,
by normal approximation.
|
double |
upperBoundNormal95Upper()
Calculates the upper bound for a 95% confidence interval, lower only
i.e., the value below which 95% of sample take,
by normal approximation.
|
double |
WilsonIntervalLower(double confidenceLevel,
double accuracy) |
double |
WilsonIntervalUpper(double confidenceLevel,
double accuracy) |
public BinomialDist(int noOfSamples, double prob)
noOfSamples
- the number of trialsprob
- success probability in each trialpublic static double erf(double z, double accuracy)
z
- input to the error function.accuracy
- a parameter deciding the accuracy of the result.public static double erfInv(double v, double accuracy)
public int getBinomialCoefficient(int k)
k
- the number of successespublic double getMean()
public int getNoOfSamples()
public double getProb()
public double getStdDev()
public double getStdScore(double rawScore)
rawScore
- raw scorepublic double getVariance()
public double lowerBoundNormal95()
public double lowerBoundNormal95Lower()
public double PMF(int k)
k
- the number of successespublic double populationAbove(double lowerBound)
lowerBound
- lower bound of the intervalpublic double populationBelow(double upperBound)
upperBound
- upper bound of the intervalpublic double populationBelowNormal(double upperBound)
upperBound
- upper bound of the intervalpublic double upperBoundNormal95()
public double upperBoundNormal95Upper()
public double WilsonIntervalLower(double confidenceLevel, double accuracy)
public double WilsonIntervalUpper(double confidenceLevel, double accuracy)