Package jsl.utilities.random.rvariable
Class NegativeBinomialRV
- java.lang.Object
-
- jsl.utilities.random.rvariable.AbstractRVariable
-
- jsl.utilities.random.rvariable.NegativeBinomialRV
-
- All Implemented Interfaces:
java.util.function.DoubleSupplier,GetNameIfc,GetValueIfc,IdentityIfc,PreviousValueIfc,RandomIfc,GetRandomNumberStreamIfc,RNStreamControlIfc,SetRandomNumberStreamIfc,NewAntitheticInstanceIfc,RVariableIfc,SampleIfc
public final class NegativeBinomialRV extends AbstractRVariable
NegativeBinomial(probability of success, number of trials until rth success)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jsl.utilities.random.rvariable.RVariableIfc
RVariableIfc.RVType
-
-
Field Summary
-
Fields inherited from class jsl.utilities.random.rvariable.AbstractRVariable
myRNStream
-
-
Constructor Summary
Constructors Constructor Description NegativeBinomialRV(double prob, double numSuccess)NegativeBinomialRV(double prob, double numSuccess, int streamNum)NegativeBinomialRV(double prob, double numSuccess, RNStreamIfc stream)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected doublegenerate()doublegetDesiredNumberOfSuccesses()Gets the desired number of successesdoublegetProbabilityOfSuccess()Gets the success probabilitystatic RVControlsmakeControls()The keys are "ProbOfSuccess", the default value is 0.5 and "NumSuccesses" with default value 1.NegativeBinomialRVnewInstance(RNStreamIfc stream)java.lang.StringtoString()-
Methods inherited from class jsl.utilities.random.rvariable.AbstractRVariable
advanceToNextSubstream, getAntitheticOption, getId, getName, getPreviousValue, getRandomNumberStream, getValue, newAntitheticInstance, newInstance, resetStartStream, resetStartSubstream, sample, setAntitheticOption, setName, setPreviousValue, setRandomNumberStream
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jsl.utilities.random.rng.GetRandomNumberStreamIfc
getStreamNumber
-
Methods inherited from interface jsl.utilities.random.rvariable.RVariableIfc
asDoubleStream, getAsDouble, getSumOfValues, newInstance
-
Methods inherited from interface jsl.utilities.random.rng.SetRandomNumberStreamIfc
setRandomNumberStream
-
-
-
-
Constructor Detail
-
NegativeBinomialRV
public NegativeBinomialRV(double prob, double numSuccess)- Parameters:
prob- the probability of success, must be in (0,1)numSuccess- number of trials until rth success
-
NegativeBinomialRV
public NegativeBinomialRV(double prob, double numSuccess, int streamNum)- Parameters:
prob- the probability of success, must be in (0,1)numSuccess- number of trials until rth successstreamNum- the stream number from the stream provider to use
-
NegativeBinomialRV
public NegativeBinomialRV(double prob, double numSuccess, RNStreamIfc stream)- Parameters:
prob- the probability of success, must be in (0,1)numSuccess- number of trials until rth successstream- the stream from the stream provider to use
-
-
Method Detail
-
newInstance
public NegativeBinomialRV newInstance(RNStreamIfc stream)
- Parameters:
stream- the random number stream to use- Returns:
- a new instance with same parameter value
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getProbabilityOfSuccess
public double getProbabilityOfSuccess()
Gets the success probability- Returns:
- The success probability
-
getDesiredNumberOfSuccesses
public double getDesiredNumberOfSuccesses()
Gets the desired number of successes- Returns:
- the number of success
-
generate
protected double generate()
- Specified by:
generatein classAbstractRVariable- Returns:
- the randomly generated variate
-
makeControls
public static RVControls makeControls()
The keys are "ProbOfSuccess", the default value is 0.5 and "NumSuccesses" with default value 1.- Returns:
- a control for Negative Binomial random variables
-
-