Class ShiftedGeometric
java.lang.Object
random.AbstractDistribution
random.discrete.DiscreteDistribution
random.discrete.ShiftedGeometric
- All Implemented Interfaces:
StorableDistribution
Shifted geometric distribution: number of trials before the first success, shifted by one.
-
Field Summary
Fields inherited from class DiscreteDistribution
cached, CDFList, CDFListCalculatedFields inherited from class AbstractDistribution
engine -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected doublecdf(double probability, int x) doublecdf(int x) doubleobtain the cumulative distribution from the distributionprotected doublecheckCached(double value) protected intcheckCached(int value) intgetlower()intgetUpper()intnextRand()These functions are used to direct initialize the Discrete Distribution.protected intnextRand(double probability) intGenerate random variables that follow an probability distributionprotected doublepmf(double probability, int x) doublepmf(int x) doubleobtain the probability distribution from the distributiondoubleprotected doubletheorMean(double probability) doubleCalculate the Mean value from the parameter of the distributiondoubleprotected doubletheorVariance(double probability) doubleCalculate the Variance from the parameter of the distributionprotected <T> TunboxParameter(Parameter p, Function<Double, T> function) booleanupdatePar(double p) booleanSub-class must implement this method to update parameter.Methods inherited from class DiscreteDistribution
binarySearch, createdCDFList, createdCDFList, inverseTransformSampling, outdatedMethods inherited from class AbstractDistribution
setRandomEngine
-
Constructor Details
-
ShiftedGeometric
public ShiftedGeometric() -
ShiftedGeometric
-
ShiftedGeometric
-
-
Method Details
-
updatePar
-
updatePar
Description copied from class:DiscreteDistributionSub-class must implement this method to update parameter.- Specified by:
updateParin classDiscreteDistribution- Throws:
IncorrectDistributionParameterException
-
getUpper
public int getUpper()- Specified by:
getUpperin classDiscreteDistribution
-
getlower
public int getlower()- Specified by:
getlowerin classDiscreteDistribution
-
unboxParameter
protected <T> T unboxParameter(Parameter p, Function<Double, T> function) throws IncorrectDistributionParameterException -
checkCached
protected int checkCached(int value) -
checkCached
protected double checkCached(double value) -
nextRand
protected int nextRand(double probability) -
nextRand
public int nextRand()Description copied from class:DiscreteDistributionThese functions are used to direct initialize the Discrete Distribution. once invoke parameter constructor with the distribution parameter, set cached = true. if not cache the parameter, only method with `Parameter` are available.- Specified by:
nextRandin classDiscreteDistribution
-
nextRand
Description copied from class:DiscreteDistributionGenerate random variables that follow an probability distribution- Specified by:
nextRandin classDiscreteDistribution- Parameters:
p- parameter of the distribution.- Returns:
- int - random variables that follow an probability distribution
- Throws:
IncorrectDistributionParameterException
-
pmf
protected double pmf(double probability, int x) -
pmf
public double pmf(int x) - Specified by:
pmfin classDiscreteDistribution
-
pmf
Description copied from class:DiscreteDistributionobtain the probability distribution from the distribution- Specified by:
pmfin classDiscreteDistribution- Parameters:
x- int - random variable indicating where to evaluate the pmf.p- parameter of the distribution.- Returns:
- double - the probability weight evaluated at x.
- Throws:
IncorrectDistributionParameterException
-
cdf
protected double cdf(double probability, int x) -
cdf
public double cdf(int x) - Specified by:
cdfin classDiscreteDistribution
-
cdf
Description copied from class:DiscreteDistributionobtain the cumulative distribution from the distribution- Specified by:
cdfin classDiscreteDistribution- Parameters:
x- int - random variable indicating where to evaluate the cdf.p- parameter of the distribution.- Returns:
- double - the probability weight cumulated at x.
- Throws:
IncorrectDistributionParameterException
-
theorMean
protected double theorMean(double probability) -
theorMean
public double theorMean()- Specified by:
theorMeanin classDiscreteDistribution
-
theorMean
Description copied from class:DiscreteDistributionCalculate the Mean value from the parameter of the distribution- Specified by:
theorMeanin classDiscreteDistribution- Parameters:
p- parameter of the distribution.- Returns:
- double - theoretic mean value of the distribution.
- Throws:
IncorrectDistributionParameterException
-
theorVariance
protected double theorVariance(double probability) -
theorVariance
public double theorVariance()- Specified by:
theorVariancein classDiscreteDistribution
-
theorVariance
Description copied from class:DiscreteDistributionCalculate the Variance from the parameter of the distribution- Specified by:
theorVariancein classDiscreteDistribution- Parameters:
p- parameter of the distribution.- Returns:
- double - theoretic variance value of the distribution.
- Throws:
IncorrectDistributionParameterException
-