Skip to content

Latest commit

 

History

History
202 lines (133 loc) · 4.06 KB

bernoulli.rst

File metadata and controls

202 lines (133 loc) · 4.06 KB

Bernoulli Distribution

Table of contents


The density function of the Bernoulli distribution:

f(x; p) = p^x (1-p)^{1-x} \times \mathbf{1}[x \in \{0,1\}]

Methods for scalar input, as well as for vector/matrix input, are listed below.

.. doxygenfunction:: dbern(const llint_t x, const T prob_par, const bool log_form)
   :project: statslib

.. doxygenfunction:: dbern(const std::vector<eT>& x, const T1 prob_par, const bool log_form)
   :project: statslib

.. doxygenfunction:: dbern(const ArmaGen<mT,tT>& X, const T1 prob_par, const bool log_form)
   :project: statslib

.. doxygenfunction:: dbern(const BlazeMat<eT,To>& X, const T1 prob_par, const bool log_form)
   :project: statslib

.. doxygenfunction:: dbern(const EigenMat<eT,iTr,iTc>& X, const T1 prob_par, const bool log_form)
   :project: statslib


The cumulative distribution function of the Bernoulli distribution:

F(x; p) = \sum_{z \leq x} f(z; p) = \begin{cases} 0 & \text{ if } x < 0 \\ 1-p & \text{ if } 0 \leq x < 1 \\ 1 & \text{ if } x \geq 1 \end{cases}

Methods for scalar input, as well as for vector/matrix input, are listed below.

.. doxygenfunction:: pbern(const llint_t, const T, const bool)
   :project: statslib

.. doxygenfunction:: pbern(const std::vector<eT>&, const T1, const bool)
   :project: statslib

.. doxygenfunction:: pbern(const ArmaMat<eT>&, const T1, const bool)
   :project: statslib

.. doxygenfunction:: pbern(const BlazeMat<eT, To>&, const T1, const bool)
   :project: statslib

.. doxygenfunction:: pbern(const EigenMat<eT, iTr, iTc>&, const T1, const bool)
   :project: statslib


The quantile function of the Bernoulli distribution:

q(r; p) = \begin{cases} 0 & \text{ if } r \leq 1 - p \\ 1 & \text{ else } \end{cases}

Methods for scalar input, as well as for vector/matrix input, are listed below.

.. doxygenfunction:: qbern(const T1, const T2)
   :project: statslib

.. doxygenfunction:: qbern(const std::vector<eT>&, const T1)
   :project: statslib

.. doxygenfunction:: qbern(const ArmaMat<eT>&, const T1)
   :project: statslib

.. doxygenfunction:: qbern(const BlazeMat<eT, To>&, const T1)
   :project: statslib

.. doxygenfunction:: qbern(const EigenMat<eT, iTr, iTc>&, const T1)
   :project: statslib


Random sampling for the Bernoulli distribution is achieved via the inverse probability integral transform.

  1. Random number engines
.. doxygenfunction:: rbern(const T, rand_engine_t&)
   :project: statslib

  1. Seed values
.. doxygenfunction:: rbern(const T, const ullint_t)
   :project: statslib

  1. Random number engines
.. doxygenfunction:: rbern(const ullint_t, const ullint_t, const T1, rand_engine_t&)
   :project: statslib

  1. Seed values
.. doxygenfunction:: rbern(const ullint_t, const ullint_t, const T1, const ullint_t)
   :project: statslib