.. :html_theme.sidebar_secondary.remove:

:orphan:

:py:mod:`comyx.stats.moments`
=============================

.. py:module:: comyx.stats.moments


Module Summary
---------------


Functions
~~~~~~~~~

.. autoapisummary::

   comyx.stats.moments.approx_gamma_params
   comyx.stats.moments.fun_mu_doublenaka
   comyx.stats.moments.fun_mu_effective
   comyx.stats.moments.fun_mu_gamma
   comyx.stats.moments.fun_mu_naka




Reference
---------

.. py:function:: approx_gamma_params(mu_1: NDArrayFloat, mu_2: NDArrayFloat, const: NDArrayFloat = np.array([1.0])) -> Tuple[NDArrayFloat, NDArrayFloat]

   Approximates the shape and scale of the Gamma distribution.

   Approximates the shape and scale parameters of the Gamma distribution
   given the first two moments of a non-negative RV. The approximation is
   based on the method of moments, given by:

   .. math::
       k = \frac{\mu^2}{\mu^{(2)} - \mu^2}

   .. math::
       \theta = \frac{\mu^{(2)} - \mu^2}{\mu}

   , where :math:`\mu` and :math:`\mu^{(2)}` are the first and second moments,
   respectively.

   :param mu_1: First moment of the RV.
   :param mu_2: Second moment of the RV.
   :param const: Constant to multiply the scale parameter by.
                 Defaults to 1.0.

   :returns: Shape and scale parameters of the Gamma distribution.


.. py:function:: fun_mu_doublenaka(p: int, m: float, k: float, omega: NDArrayFloat, theta: NDArrayFloat, c: float, N: int) -> NDArrayFloat

   Computes the p-th moment of the sum of two independent Nakagami-m RVs.

   .. math::
       G = \sqrt{c} \sum_{n=1}^{N} |{h_1}||{h_2}|

   , where :math:`h_1 \sim Nakagami(m, \Omega)` and :math:`h_2 \sim Nakagami(k,
   \theta)`.

   :param p: Order of the moment to compute.
   :param m: Shape parameter of the first distribution :math:`h_1`.
   :param k: Shape parameter of the second distribution :math:`h_2`.
   :param omega: Scale parameter of the first distribution :math:`h_1`.
   :param theta: Scale parameter of the second distribution :math:`h_2`.
   :param c: Summation constant.
   :param N: Number of summation terms.

   :returns: The p-th moment of the sum of two independent Nakagami-m random
             variables.


.. py:function:: fun_mu_effective(p: int, m_h: float, m_Ga: float, m_Gb: float, omega_h: NDArrayFloat, omega_Ga: NDArrayFloat, omega_Gb: NDArrayFloat, c: float, N: int)

   Computes the p-th moment of the effective channel distribution.

   .. math::
       Z = |H|^2 = (h + G)^2

   , where :math:`h \sim Nakagami(m, \Omega)` and :math:`G \sim \Gamma(k_G,
   \theta_G)`. Furthermore, :math:`G` is defined as:

   .. math::
       G = \sqrt{c} \sum_{n=1}^{N} |{h_1}||{h_2}|

   :param p: Order of the moment to compute. Only p = 1 and p = 2 are supported.
   :param m_h: Shape parameter of h distribution.
   :param m_Ga: Shape parameter of the first distribution of :math:`G`.
   :param m_Gb: Shape parameter of the second distribution of :math:`G`.
   :param omega_h: Scale parameter of h distribution.
   :param omega_Ga: Scale parameter of the first distribution of :math:`G`.
   :param omega_Gb: Scale parameter of the second distribution of :math:`G`.
   :param c: Summation constant.
   :param N: Number of summation terms.

   :returns: The p-th moment of the effective channel distribution.


.. py:function:: fun_mu_gamma(p: int, k: float, theta: NDArrayFloat) -> NDArrayFloat

   Computes the p-th moment of the Gamma distribution.

   :param p: Order of the moment to compute.
   :param k: Shape parameter of the distribution.
   :param theta: Scale parameter of the distribution.

   :returns: The p-th moment of the Gamma distribution.


.. py:function:: fun_mu_naka(p: int, m: float, omega: NDArrayFloat) -> NDArrayFloat

   Computes the p-th moment of the Nakagami-m distribution.

   :param p: Order of the moment to compute.
   :param m: Shape parameter of the distribution.
   :param omega: Scale parameter of the distribution.

   :returns: The p-th moment of the Nakagami-m distribution.


