Package jsl.utilities.random.rvariable
Class EmpiricalRV
- java.lang.Object
-
- jsl.utilities.random.rvariable.AbstractRVariable
-
- jsl.utilities.random.rvariable.EmpiricalRV
-
- All Implemented Interfaces:
java.util.function.DoubleSupplier
,GetNameIfc
,GetValueIfc
,IdentityIfc
,PreviousValueIfc
,RandomIfc
,GetRandomNumberStreamIfc
,RNStreamControlIfc
,SetRandomNumberStreamIfc
,NewAntitheticInstanceIfc
,RVariableIfc
,SampleIfc
public final class EmpiricalRV extends AbstractRVariable
A random variable that samples from the provided data
-
-
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 EmpiricalRV(double[] data)
EmpiricalRV(double[] data, int streamNum)
EmpiricalRV(double[] data, RNStreamIfc rng)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
generate()
static RVControls
makeControls()
The key is "Population", an empty array of size 1 is made.RVariableIfc
newInstance(RNStreamIfc rng)
-
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, toString, 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
-
EmpiricalRV
public EmpiricalRV(double[] data)
-
EmpiricalRV
public EmpiricalRV(double[] data, int streamNum)
-
EmpiricalRV
public EmpiricalRV(double[] data, RNStreamIfc rng)
-
-
Method Detail
-
newInstance
public RVariableIfc newInstance(RNStreamIfc rng)
- Parameters:
rng
- the RNStreamIfc to use- Returns:
- a new instance with same parameter values
-
generate
protected double generate()
- Specified by:
generate
in classAbstractRVariable
- Returns:
- the randomly generated variate
-
makeControls
public static RVControls makeControls()
The key is "Population", an empty array of size 1 is made. The user of the control can provide any size population back- Returns:
- a control for Bernoulli random variables
-
-