2%> Return the corresponding natural logarithm(s) of Probability Density Function (PDF)
3%> of the input random value(s) from the Generalized Gamma distribution.<br>
6%> A variable \f$X\f$ is said to be **Generalized Gamma** (GenGamma) distributed
if its PDF with the **scale** \f$0 < \sigma < +\infty\f$,
7%> **shape** \f$0 < \omega < +\infty\f$, and **shape** \f$0 < \kappa < +\infty\f$ parameters is described by the following equation,
11%> \pi(x | \kappa, \omega, \sigma) =
12%> \frac{1}{\sigma \omega \Gamma(\kappa)} ~
13%> \bigg( \frac{x}{\sigma} \bigg)^{\frac{\kappa}{\omega} - 1} \exp\Bigg( -\bigg(\frac{x}{\sigma}\bigg)^{\frac{1}{\omega}} \Bigg) ~,~ 0 < x < \infty
16%> where \f$\eta = \frac{1}{\sigma \omega \Gamma(\kappa)}\f$ is the **normalization factor** of the PDF.<br>
17%> When \f$\sigma = 1\f$, the GenGamma PDF simplifies to the form,
22%> \frac{1}{\omega \Gamma(\kappa)} ~
23%> x^{\frac{\kappa}{\omega} - 1} \exp\Bigg( -x^{\frac{1}{\omega}} \Bigg) ~,~ 0 < x < \infty
26%> If \f$(\sigma, \omega) = (1, 1)\f$, the GenGamma PDF further simplifies to the form,
31%> \frac{1}{\Gamma(\kappa)} ~
32%> x^{\kappa - 1} \exp(-x) ~,~ 0 < x < \infty
35%> Setting the shape parameter to \f$\kappa = 1\f$ further simplifies the PDF to the Exponential distribution PDF with the scale parameter \f$\sigma = 1\f$,
39%> \pi(x) = \exp(x) ~,~ 0 < x < \infty
43%> <li> The parameter \f$\sigma\f$ determines the scale of the GenGamma PDF.<br>
44%> <li> When \f$\omega = 1\f$, the GenGamma PDF reduces to the PDF of the Gamma distribution.<br>
45%> <li> When \f$\kappa = 1, \omega = 1\f$, the GenGamma PDF reduces to the PDF of the Exponential distribution.<br>
48%> The **CDF** of the Generalized Gamma distribution over a strictly-positive support \f$x \in (0, +\infty)\f$ with the three (shape, shape, scale)
49%> parameters \f$(\kappa > 0, \omega > 0, \sigma > 0)\f$ is defined by the **regularized** Lower Incomplete Gamma function as,
52%> \mathrm{CDF}(x | \kappa, \omega, \sigma)
53%> & = & P\bigg(\kappa, \big(\frac{x}{\sigma}\big)^{\frac{1}{\omega}} \bigg) \\
54%> & = & \frac{1}{\Gamma(\kappa)} \int_0^{\big(\frac{x}{\sigma}\big)^{\frac{1}{\omega}}} ~ t^{\kappa - 1}{\mathrm e}^{-t} ~ dt ~,
57%> where \f$\Gamma(\kappa)\f$ represents the Gamma function.<br>
59%> \param[in] x : The input scalar or array of the same shape as other array-valued arguments,
60%> containing the values at
which the log(PDF) must be computed.<br>
61%> \param[in] kappa : The input scalar or array of the same shape as other array-valued arguments,
62%> containing the shape parameter (\f$\kappa\f$) of the distribution.<br>
63%> \param[in] invOmega : The input scalar or array of the same shape as other array-valued arguments,
64%> containing the inverse of the second shape parameter (\f$\omega\f$) of the distribution.<br>
65%> \param[in] invSigma : The input scalar or array of the same shape as other array-valued arguments,
66%> containing the inverse of the scale parameter (\f$\sigma\f$) of the distribution.<br>
69%> `logPDF` : The output scalar or array of the same shape as other array-valued input arguments
70%> of the same type and kind as `x` containing the PDF of the specified GenGamma distribution.
75%> logPDF = pm.stats.dist.gengamma.getLogPDF(x, kappa, invOmega, invSigma)
80%> \include{lineno} example/stats/dist/gengamma/
getLogPDF/main.m
82%> \include{lineno} example/stats/dist/gengamma/
getLogPDF/main.out.m
84%> \image html example/stats/dist/gengamma/
getLogPDF/gengamma.getLogPDF.line.png width=700
89%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
90%> \AmirShahmoradi, July 19, 2024, 1:07 AM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
91function logPDF =
getLogPDF(x, kappa, invOmega, invSigma)
92 assert(all(0 < x),
'The condition `all(0 < x)` must hold.');
93 assert(all(0 < kappa),
'The condition `all(0 < kappa)` must hold.');
94 assert(all(0 < invOmega),
'The condition `all(0 < invOmega)` must hold.');
95 assert(all(0 < invSigma),
'The condition `all(0 < invSigma)` must hold.');
96 xscaled = x .* invSigma;
97 logPDFNF = log(invOmega) + log(invSigma) - gammaln(kappa);
98 logPDF = logPDFNF + log(xscaled) .* (kappa .* invOmega - 1) - xscaled.^invOmega;
function getLogPDF(in x, in kappa, in invOmega, in invSigma)
Return the corresponding natural logarithm(s) of Probability Density Function (PDF) of the input rand...
function which(in vendor)
Return the a MATLAB string containing the path to the first mpiexec executable binary found in system...