comyx.stats
#
Package Summary#
Functions#
|
Approximates the shape and scale of the Gamma distribution. |
|
Computes the p-th moment of the sum of two independent Nakagami-m RVs. |
|
Computes the p-th moment of the effective channel distribution. |
|
Computes the p-th moment of the Gamma distribution. |
|
Computes the p-th moment of the Nakagami-m distribution. |
|
Computes the parameters of the sum of two independent Gamma random variables. |
|
Computes the parameters of the ratio of two independent Gamma random variables. |
|
Computes the parameters of the sum of a Gamma random variable and one. |
|
Computes the ergodic rate of the system. |
|
Computes the probability of inter-related SNRs. |
|
Computes the probability of the received SNR being less than the threshold. |
|
Computes the outage probability of the system using the Q-function. |
Reference#
- comyx.stats.approx_gamma_params(mu_1: NDArrayFloat, mu_2: NDArrayFloat, const: NDArrayFloat = np.array([1.0])) Tuple[NDArrayFloat, NDArrayFloat] [source]#
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:
\[k = \frac{\mu^2}{\mu^{(2)} - \mu^2}\]\[\theta = \frac{\mu^{(2)} - \mu^2}{\mu}\], where \(\mu\) and \(\mu^{(2)}\) are the first and second moments, respectively.
- Parameters:
mu_1 – First moment of the RV.
mu_2 – Second moment of the RV.
const – Constant to multiply the scale parameter by. Defaults to 1.0.
- Returns:
Shape and scale parameters of the Gamma distribution.
- comyx.stats.fun_mu_doublenaka(p: int, m: float, k: float, omega: NDArrayFloat, theta: NDArrayFloat, c: float, N: int) NDArrayFloat [source]#
Computes the p-th moment of the sum of two independent Nakagami-m RVs.
\[G = \sqrt{c} \sum_{n=1}^{N} |{h_1}||{h_2}|\], where \(h_1 \sim Nakagami(m, \Omega)\) and \(h_2 \sim Nakagami(k, \theta)\).
- Parameters:
p – Order of the moment to compute.
m – Shape parameter of the first distribution \(h_1\).
k – Shape parameter of the second distribution \(h_2\).
omega – Scale parameter of the first distribution \(h_1\).
theta – Scale parameter of the second distribution \(h_2\).
c – Summation constant.
N – Number of summation terms.
- Returns:
The p-th moment of the sum of two independent Nakagami-m random variables.
- comyx.stats.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)[source]#
Computes the p-th moment of the effective channel distribution.
\[Z = |H|^2 = (h + G)^2\], where \(h \sim Nakagami(m, \Omega)\) and \(G \sim \Gamma(k_G, \theta_G)\). Furthermore, \(G\) is defined as:
\[G = \sqrt{c} \sum_{n=1}^{N} |{h_1}||{h_2}|\]- Parameters:
p – Order of the moment to compute. Only p = 1 and p = 2 are supported.
m_h – Shape parameter of h distribution.
m_Ga – Shape parameter of the first distribution of \(G\).
m_Gb – Shape parameter of the second distribution of \(G\).
omega_h – Scale parameter of h distribution.
omega_Ga – Scale parameter of the first distribution of \(G\).
omega_Gb – Scale parameter of the second distribution of \(G\).
c – Summation constant.
N – Number of summation terms.
- Returns:
The p-th moment of the effective channel distribution.
- comyx.stats.fun_mu_gamma(p: int, k: float, theta: NDArrayFloat) NDArrayFloat [source]#
Computes the p-th moment of the Gamma distribution.
- Parameters:
p – Order of the moment to compute.
k – Shape parameter of the distribution.
theta – Scale parameter of the distribution.
- Returns:
The p-th moment of the Gamma distribution.
- comyx.stats.fun_mu_naka(p: int, m: float, omega: NDArrayFloat) NDArrayFloat [source]#
Computes the p-th moment of the Nakagami-m distribution.
- Parameters:
p – Order of the moment to compute.
m – Shape parameter of the distribution.
omega – Scale parameter of the distribution.
- Returns:
The p-th moment of the Nakagami-m distribution.
- comyx.stats.gamma_add_params(mu_a_1: NDArrayFloat, mu_a_2: NDArrayFloat, mu_b_1: NDArrayFloat, mu_b_2: NDArrayFloat, a: NDArrayFloat = np.array([1.0]), b: NDArrayFloat = np.array([1.0]), return_type: str = 'params') Tuple[NDArrayFloat, NDArrayFloat] [source]#
Computes the parameters of the sum of two independent Gamma random variables.
The first distribution is optionally weighted by a, and the second by b.
\[z = a h + b g\], where \(h \sim \Gamma(k_a, \theta_a)\) and \(g \sim \Gamma(k_b, \theta_b)\). Also,
\[k_n = \frac{\mu_{n,1}^{(2)}}{\mu_{n,2} - \mu_{n,1}^{(2)}}\]\[\theta_n = \frac{\mu_{n,2} - \mu_{n,1}^{(2)}}{\mu_{n,1}}\], where \(n \in \{a, b\}\).
The resulting distribution is a Gamma distribution, expressed as:
\[z \sim \Gamma(k_z, \theta_z)\]- Parameters:
mu_a_1 – First moment of the first Gamma distribution \(h\).
mu_a_2 – Second moment of the first Gamma distribution \(h\).
mu_b_1 – First moment of the second Gamma distribution \(g\).
mu_b_2 – Second moment of the second Gamma distribution \(g\).
a – Shape parameter of the first Gamma distribution \(h\).
b – Shape parameter of the second Gamma distribution \(g\).
return_type – Return type of the function. Must be either “params” or “moments”.
- Returns:
Desired parameters of the sum of a Gamma random variable and one. If return_type is “params”, returns the shape and scale parameters of the sum of two independent Gamma random variables. If return_type is “moments”, returns the first two moments of the sum of two independent Gamma random variables.
- comyx.stats.gamma_div_gamma_dist(k_a: NDArrayFloat, k_b: NDArrayFloat, theta_a: NDArrayFloat, theta_b: NDArrayFloat) RVDistribution [source]#
Computes the parameters of the ratio of two independent Gamma random variables.
\[z = \frac{h}{g}\], where \(h \sim \Gamma(k_a, \theta_a)\) and \(g \sim \Gamma(k_b, \theta_b)\). The resulting distribution is a Beta prime distribution, expressed as:
\[z \sim \beta'(k_a, k_b, \theta_a / \theta_b)\]- Parameters:
k_a – Shape parameter of the first Gamma distribution \(h\).
k_b – Shape parameter of the second Gamma distribution \(g\).
theta_a – Scale parameter of the first Gamma distribution \(h\).
theta_b – Scale parameter of the second Gamma distribution \(g\).
- Returns:
A beta prime distribution with shape parameters k_a and k_b, and scale parameter theta_a / theta_b.
- comyx.stats.gamma_plus_one_params(mu_a_1: NDArrayFloat, mu_a_2: NDArrayFloat, a: NDArrayFloat = np.array([1.0]), return_type: str = 'params') Tuple[NDArrayFloat, NDArrayFloat] [source]#
Computes the parameters of the sum of a Gamma random variable and one.
\[z = h + 1\], where \(h \sim \Gamma(k_a, \theta_a)\). Also,
\[k_a = \frac{\mu_{a,1}^{(2)}}{\mu_{a,2} - \mu_{a,1}^{(2)}}\]\[\theta_a = \frac{\mu_{a,2} - \mu_{a,1}^{(2)}}{\mu_{a,1}}\]- Parameters:
mu_a_1 – First moment of the Gamma distribution.
mu_a_2 – Second moment of the Gamma distribution.
return_type – Return type of the function. Must be either “params” or “moments”.
- Returns:
Desired parameters of the sum of a Gamma random variable and one. If return_type is “params”, returns the shape and scale parameters of the sum of a Gamma random variable and one. If return_type is “moments”, returns the first two moments of the sum of a Gamma random variable and one.
- comyx.stats.get_ergodic_rate(k: float, m: float, theta: float, omega: float) float [source]#
Computes the ergodic rate of the system.
\[\begin{split}\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)}\end{split}\]- Parameters:
k – Shape parameter of the numerator Gamma distribution.
m – Shape parameter of the denominator Gamma distribution.
theta – Scale parameter of the numerator Gamma distribution.
omega – Scale parameter of the denominator Gamma distribution.
- Returns:
The ergodic rate of the system.
- comyx.stats.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 [source]#
Computes the probability of inter-related SNRs.
More specifically, it computes the probability of SNRs being greater than one threshold, but less than another.
\[\begin{split}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)}\end{split}\], where \(\lambda_{a}=10\ln(x)\), with \(x \sim \beta'(k_a, m_a, \theta_a / \Omega_a)\) and \(\lambda_{b}=10\ln(y)\), with \(y \sim \beta'(k_b, m_b, \theta_b / \Omega_b)\).
- Parameters:
k_a – Shape parameter of the numerator Gamma distribution of lambda_a.
m_a – Shape parameter of the denominator Gamma distribution of lambda_a.
theta_a – Scale parameter of the numerator Gamma distribution of lambda_a.
omega_a – Scale parameter of the denominator Gamma distribution of lambda_a.
k_b – Shape parameter of the numerator Gamma distribution of lambda_b.
m_b – Shape parameter of the denominator Gamma distribution of lambda_b.
theta_b – Scale parameter of the numerator Gamma distribution of lambda_b.
omega_b – Scale parameter of the denominator Gamma distribution of lambda_b.
lambda_a – First threshold of the received SNR.
lambda_b – Second threshold of the received SNR.
- Returns:
The outage probability of the system.
- comyx.stats.get_outage_lt(k: float, m: float, theta: float, omega: float, lambda_th: float) float [source]#
Computes the probability of the received SNR being less than the threshold.
\[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 \(\lambda_{r}=10\ln(x)\), with \(x \sim \beta'(k, m, \theta / \Omega)\).
- Parameters:
k – Shape parameter of the numerator Gamma distribution.
m – Shape parameter of the denominator Gamma distribution.
theta – Scale parameter of the numerator Gamma distribution.
omega – Scale parameter of the denominator Gamma distribution.
lambda_th – Threshold of the received SNR.
- Returns:
The outage probability of the system.
- comyx.stats.get_outage_q(Pr: NDArrayFloat, threshold: float) NDArrayFloat [source]#
Computes the outage probability of the system using the Q-function.
The Q-function is defined as:
\[Q(x)=\frac{1}{\sqrt{2 \pi}} \int_{x}^{\infty} e^{-\frac{u^{2}}{2}} d u\]- Parameters:
Pr – The received power of the system.
threshold – The threshold of the received power.
- Returns:
An array containing the outages of the system.