.. :html_theme.sidebar_secondary.remove:

:orphan:

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

.. py:module:: comyx.stats.metrics


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


Functions
~~~~~~~~~

.. autoapisummary::

   comyx.stats.metrics.get_ergodic_rate
   comyx.stats.metrics.get_outage_clt
   comyx.stats.metrics.get_outage_lt
   comyx.stats.metrics.get_outage_q




Reference
---------

.. py:function:: get_ergodic_rate(k: float, m: float, theta: float, omega: float) -> float

   Computes the ergodic rate of the system.

   .. math::
       \mathcal{R(k,m,\theta,\Omega)}=\frac{1}{{\log (2) \Gamma (k+m) B(k,m)}}{G_{3,3}^{3,2}\left(\frac{\Omega }{\theta }|\begin{array}{c}0,1-m,1 \\0,0,k \\\end{array}\right)}

   :param k: Shape parameter of the numerator Gamma distribution.
   :param m: Shape parameter of the denominator Gamma distribution.
   :param theta: Scale parameter of the numerator Gamma distribution.
   :param omega: Scale parameter of the denominator Gamma distribution.

   :returns: The ergodic rate of the system.


.. py:function:: get_outage_clt(k_a: float, m_a: float, theta_a: float, omega_a: float, k_b: float, m_b: float, theta_b: float, omega_b: float, lambda_a: float, lambda_b: float) -> float

   Computes the probability of inter-related SNRs.

   More specifically, it computes the probability of SNRs being greater than
   one threshold, but less than another.

   .. math::
       Pr(\lambda_{a}\gt\lambda_{th}, \lambda_{b}\lt\gamma_{th})=\frac{1}{k_b \Gamma\left(m_a\right) B\left(k_b,m_b\right)}{\left(\frac{10^{\gamma /10} \Omega _b}{\theta_b}\right){}^{k_b} {_2F_1\left(k_b,k_b+m_b;k_b+1;-\frac{10^{\gamma /10} \Omega_b}{\theta _b}\right)}} \\
       {\left(\Gamma \left(m_a\right)-\Gamma\left(k_a+m_a\right) \left(\frac{10^{\lambda /10} \Omega_a}{\theta _a}\right){}^{k_a} {_2\tilde{F}_1\left(k_a,k_a+m_a;k_a+1;-\frac{10^{\lambda /10}\Omega _a}{\theta _a}\right)}\right)}

   , where :math:`\lambda_{a}=10\ln(x)`, with :math:`x \sim \beta'(k_a, m_a, \theta_a / \Omega_a)` and :math:`\lambda_{b}=10\ln(y)`, with :math:`y \sim \beta'(k_b, m_b, \theta_b / \Omega_b)`.

   :param k_a: Shape parameter of the numerator Gamma distribution of lambda_a.
   :param m_a: Shape parameter of the denominator Gamma distribution of lambda_a.
   :param theta_a: Scale parameter of the numerator Gamma distribution of
                   lambda_a.
   :param omega_a: Scale parameter of the denominator Gamma distribution of
                   lambda_a.
   :param k_b: Shape parameter of the numerator Gamma distribution of lambda_b.
   :param m_b: Shape parameter of the denominator Gamma distribution of lambda_b.
   :param theta_b: Scale parameter of the numerator Gamma distribution of
                   lambda_b.
   :param omega_b: Scale parameter of the denominator Gamma distribution of
                   lambda_b.
   :param lambda_a: First threshold of the received SNR.
   :param lambda_b: Second threshold of the received SNR.

   :returns: The outage probability of the system.


.. py:function:: get_outage_lt(k: float, m: float, theta: float, omega: float, lambda_th: float) -> float

   Computes the probability of the received SNR being less than the threshold.

   .. math::
       Pr(\lambda_{r}\lt\lambda_{th})=\frac{1}{{k B(k,m)}}{\left(\frac{10^{\lambda_{th} /10} \Omega}{\theta }\right)^k{_2F_1\left(k,k+m;k+1;-\frac{10^{\lambda_{th} /10} \Omega }{\theta}\right)}}

   , where :math:`\lambda_{r}=10\ln(x)`, with :math:`x \sim \beta'(k, m, \theta / \Omega)`.

   :param k: Shape parameter of the numerator Gamma distribution.
   :param m: Shape parameter of the denominator Gamma distribution.
   :param theta: Scale parameter of the numerator Gamma distribution.
   :param omega: Scale parameter of the denominator Gamma distribution.
   :param lambda_th: Threshold of the received SNR.

   :returns: The outage probability of the system.


.. py:function:: get_outage_q(Pr: NDArrayFloat, threshold: float) -> NDArrayFloat

   Computes the outage probability of the system using the Q-function.

   The Q-function is defined as:

   .. math::
       Q(x)=\frac{1}{\sqrt{2 \pi}} \int_{x}^{\infty} e^{-\frac{u^{2}}{2}} d u

   :param Pr: The received power of the system.
   :param threshold: The threshold of the received power.

   :returns: An array containing the outages of the system.


