ikr.simlib.distributions.continuous

Class EmpiricalDistribution

• ```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:

• It is best always give the final value of 1.0.
• The first entry must be `(x|0.0)`, where `x` is an arbitrary double.
• Avoid identical values in the last 2 entries.
`GeneralDistribution`

• Fields inherited from class ikr.simlib.distributions.Distribution

`rng`
• Constructor Summary

Constructors
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)```
• Method Summary

Methods
Modifier and Type Method and Description
`double` `next()`
Create random numbers
• Methods inherited from class ikr.simlib.distributions.Distribution

`getDefaultRNG, getRandomNumberGenerator, reset`
• Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• Constructor Detail

• EmpiricalDistribution

```public EmpiricalDistribution(double[] vector,
RandomNumberGenerator rng)```
• EmpiricalDistribution

`public EmpiricalDistribution(double[] vector)`
• EmpiricalDistribution

```public EmpiricalDistribution(java.util.List<java.lang.Double> vector,
RandomNumberGenerator rng)```
• EmpiricalDistribution

`public EmpiricalDistribution(java.util.List<java.lang.Double> vector)`
• Method Detail

• next

`public double next()`
Description copied from class: `ContinuousDistribution`
Create random numbers
Specified by:
`next` in class `ContinuousDistribution`