Skip to content

Commit 18a8b74

Browse files
committed
Add a specification for Discrete Distribution
The description how to imitate the discrete distribution with histogram is replaced by the specification for the discrete distribution. The discrete distribution inherits its grammar from the histogram. The only difference is that there's no need for starting b_0 boundary, and boundaries are worded as discrete values. Closes #29
1 parent 56564ae commit 18a8b74

File tree

3 files changed

+32
-15
lines changed

3 files changed

+32
-15
lines changed

mef/schema/random_deviate.rnc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ beta-deviate = element beta-deviate { expression, expression }
1111

1212
histogram = element histogram { expression, bin+ }
1313

14+
discrete = element discrete { bin+ }
15+
1416
bin = element bin { expression, expression }

mef/schema/stochastic_layer.rnc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ random-deviate =
1818
| gamma-deviate
1919
| beta-deviate
2020
| histogram
21+
| discrete
2122

2223
test-event = test-initiating-event | test-functional-event

mef/stochastic_layer.rst

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ When used to perform Monte-Carlo simulations,
533533
they return a number drawn at pseudo-random according to their type.
534534
The Model Exchange Format includes two types of random deviates:
535535
built-in deviates like uniform, normal or lognormal,
536-
and histograms that are user defined discrete distributions.
536+
and user defined discrete distributions like histograms.
537537
A preliminary list of distributions is summarized in :numref:`table_random_deviates`.
538538
As for arithmetic operators and built-ins, this list can be extended on demand.
539539

@@ -556,6 +556,8 @@ As for arithmetic operators and built-ins, this list can be extended on demand.
556556
+-----------------------+------------+-------------------------------------------------------------------------------------------------------------+
557557
| **histograms** | any | discrete distributions defined by means of a list of pairs |
558558
+-----------------------+------------+-------------------------------------------------------------------------------------------------------------+
559+
| **discrete** | >1 | discrete distributions defined by means of a list of pairs |
560+
+-----------------------+------------+-------------------------------------------------------------------------------------------------------------+
559561

560562
Uniform Deviates
561563
These primitives describe uniform distributions in a given range
@@ -685,9 +687,7 @@ Histograms
685687
686688
\mathbf{E}(X) = \frac{1}{x_n - x_0} \times \sum_{i=1}^{n}(x_i - x_{i-1})\mathbf{E}(E_i)
687689
688-
Both Cumulative Distribution Functions
689-
and Density Probability Distributions can be translated into histograms.
690-
690+
Cumulative Distribution Functions can be translated into histograms.
691691
A Cumulative Distribution Function is a list of pairs
692692
:math:`(p_1, v_1), \ldots, (p_n, v_n)`,
693693
where the :math:`p_i`'s are
@@ -701,17 +701,31 @@ Histograms
701701
with the initial value
702702
:math:`x_0 = 0, x_1 = p_1, \text{ and } x_i = p_i - p_{i-1} \text{ for all } i>1`.
703703

704-
A Discrete Probability Distribution is a list of pairs
705-
:math:`(d_1, m_1), \ldots, (d_n, m_n)`.
706-
The :math:`d_i`'s are probability densities.
707-
However, they could be any kind of values.
708-
The :math:`m_i`'s are midpoints of intervals
709-
and are such that :math:`m_1 < m_2 < \ldots < m_n < 1`.
710-
The histogram that corresponds to a Discrete Probability Distribution
711-
:math:`(d_1, m_1), \ldots, (d_n, m_n)`
712-
is the list of pairs :math:`(x_1, d_1), \ldots, (x_n, d_n)`,
713-
with the initial value
714-
:math:`x_0 = 0, x_1 = 2m_1, \text{ and } x_i = x_{i-1} + 2(m_i - x_{i-1})`.
704+
Discrete Distribution
705+
A discrete distribution is a statistical distribution
706+
whose variables can only take discrete values.
707+
It is defined by a list of pairs
708+
:math:`(a_1, w_1), \ldots, (a_n, w_n)`.
709+
The :math:`a_i`'s are the values of the distribution,
710+
and the :math:`w_i` are their respective non-negative weights.
711+
712+
The probability density function of the discrete distribution:
713+
714+
.. math::
715+
716+
f(x;w_1,\ldots,w_n) = \frac{w_k}{\sum_{i=1}^{n}w_i}
717+
718+
Where :math:`k` is such that
719+
720+
.. math::
721+
722+
x = a_k \quad \forall k \in \mathbb{Z} : 1 \leq k \leq n
723+
724+
The default value is the expected value of the distribution.
725+
726+
.. math::
727+
728+
E(x) = \dfrac{\sum_{i=1}^{n}a_i \cdot w_i}{\sum_{i=1}^{n}w_i}
715729
716730
717731
XML Representation

0 commit comments

Comments
 (0)