ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
getLogPDF.m
Go to the documentation of this file.
1%> \brief
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>
4%>
5%> \details
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,
8%>
9%> \f{equation}{
10%> \large
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
14%> \f}
15%>
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,
18%>
19%> \f{equation}{
20%> \large
21%> \pi(x) =
22%> \frac{1}{\omega \Gamma(\kappa)} ~
23%> x^{\frac{\kappa}{\omega} - 1} \exp\Bigg( -x^{\frac{1}{\omega}} \Bigg) ~,~ 0 < x < \infty
24%> \f}
25%>
26%> If \f$(\sigma, \omega) = (1, 1)\f$, the GenGamma PDF further simplifies to the form,
27%>
28%> \f{equation}{
29%> \large
30%> \pi(x) =
31%> \frac{1}{\Gamma(\kappa)} ~
32%> x^{\kappa - 1} \exp(-x) ~,~ 0 < x < \infty
33%> \f}
34%>
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$,
36%>
37%> \f{equation}{
38%> \large
39%> \pi(x) = \exp(x) ~,~ 0 < x < \infty
40%> \f}
41%>
42%> <ol>
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>
46%> </ol>
47%>
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,
50%> \f{eqnarray}{
51%> \large
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 ~,
55%> \f}
56%>
57%> where \f$\Gamma(\kappa)\f$ represents the Gamma function.<br>
58%>
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>
67%>
68%> \return
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.
71%>
72%> \interface{getLogPDF}
73%> \code{.m}
74%>
75%> logPDF = pm.stats.dist.gengamma.getLogPDF(x, kappa, invOmega, invSigma)
76%>
77%> \endcode
78%>
79%> \example{getLogPDF}
80%> \include{lineno} example/stats/dist/gengamma/getLogPDF/main.m
81%> \output{getLogPDF}
82%> \include{lineno} example/stats/dist/gengamma/getLogPDF/main.out.m
83%> \vis{getLogPDF}
84%> \image html example/stats/dist/gengamma/getLogPDF/gengamma.getLogPDF.line.png width=700
85%>
86%> \final{getLogPDF}
87%>
88%> \author
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;
99end
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...