public class EmpiricalDistribution extends ContinuousDistribution
EmpiricalDistribution
allows to read empirical distributions
obtained e.g.from measurements into a simulation program.
This is useful if no mathematical fit can be found to describe a distribution or if a measured distribution has to be integrated into a simulation very fast.
EmpiricalDistribution
is a continuous distribution and requires
2-tuples as input data: value and cdf-probability. This allows to have
arbitrarily spaced data.
Similar to GeneralDistribution
it relies on the
DistributionVector
. This reads the 2-tuple-vector and generates
2 separate vectors for values and probabilities. Using the same search
algorithm as ProbabilityVector
it determines the upper bound of
the determined bin and then does a linear interpolation between that bin and
the next lower bin (if any) to determine the fraction of the bin the search
value points to. The return value is determined by calculating that same
fraction between the corresponding vector elements of the value vector.
| x | x RND>| - - - - - - - - - . ` | . `| | x x x | | x | ----x---+---+---+---+---+---+---+---+---+---+--> v RV
The simulation par-file should look like the following:
EmpiricalDist { CDF = { 0.000 , 0.00000000 , 1.000 , 0.05000000 , 2.000 , 0.10000000 , 10.000 , 0.25000000 , 20.000 , 0.30000000 , 30.000 , 0.50000000 , 40.000 , 0.60000000 , 50.000 , 0.80000000 , 100.000 , 0.95000000 , 110.000 , 1.00000000 }; }
Notes:
(x|0.0)
, where
x
is an arbitrary double.Meaning: | distribution function is passed to constructor as vector or parsed from
file c.f. detailed comments in header file description |
---|---|
Parameters: | distribution function |
PDF: | |
DF: | passed to constructor as vector or parsed from file |
Expected value: | depends on DF |
Variance: | depends on DF |
Coefficient of variation: | depends on DF |
Parser example: |
[...].Distribution = EmpiricalDist
|
GeneralDistribution
rng
CREATE_INSTANCE_METHOD_NAME
Constructor and Description |
---|
EmpiricalDistribution(double[] vector) |
EmpiricalDistribution(double[] vector,
RandomNumberGenerator rng) |
EmpiricalDistribution(java.util.List<java.lang.Double> vector) |
EmpiricalDistribution(java.util.List<java.lang.Double> vector,
RandomNumberGenerator rng) |
Modifier and Type | Method and Description |
---|---|
static EmpiricalDistribution |
createInstance(SimNode ownNode,
Parameters pars,
RandomNumberGenerator rng)
as required by
ReflectionConstructable |
double |
next()
Create random numbers
|
getDefaultRNG, getRandomNumberGenerator, reset
public EmpiricalDistribution(double[] vector, RandomNumberGenerator rng)
public EmpiricalDistribution(double[] vector)
public EmpiricalDistribution(java.util.List<java.lang.Double> vector, RandomNumberGenerator rng)
public EmpiricalDistribution(java.util.List<java.lang.Double> vector)
public static EmpiricalDistribution createInstance(SimNode ownNode, Parameters pars, RandomNumberGenerator rng)
ReflectionConstructable
public double next()
ContinuousDistribution
next
in class ContinuousDistribution