1
2\begin{tabular}{lcll}\hline
3Variate    & $x$         & \ccode{double} &  $\mu \leq x < \infty$ \\
4Location   & $\mu$       & \ccode{double} &  $-\infty < \mu < \infty$\\
5Scale      & $\lambda$   & \ccode{double} &  $\lambda > 0$ \\
6Shape      & $\tau$      & \ccode{double} &  $\tau > 0$ \\ \hline
7\end{tabular}
8
9The probability density function (PDF) is:
10
11\begin{equation}
12P(X=x) =  \frac{\lambda^{\tau}}{\Gamma(\tau)}  (x-\mu)^{\tau-1}  e^{-\lambda (x - \mu)}
13\label{eqn:gamma_pdf}
14\end{equation}
15
16The cumulative distribution function (CDF) does not have an analytical
17expression. It is calculated numerically, using the incomplete Gamma
18function (\ccode{esl\_stats\_IncompleteGamma()}).
19
20The ``standard Gamma distribution'' has $\mu = 0$, $\lambda = 1$.
21
22\subsection{Sampling}
23
24
25
26\subsection{Parameter estimation}
27
28\subsubsection{Complete data; known location}
29
30We usually know the location $\mu$. It is often 0, or in the case of
31fitting a gamma density to a right tail, we know the threshold $\mu$
32at which we truncated the tail.
33
34Given a complete dataset of $N$ observed samples $x_i$ ($i=1..N$) and
35a \emph{known} location parameter $\mu$, maximum likelihood estimation
36of $\lambda$ and $\tau$ is performed by first solving this rootfinding
37equation for $\hat{\tau}$ by binary search:
38
39\begin{equation}
40  \log \hat{\tau}
41  - \Psi(\hat{\tau})
42  - \log \left[ \frac{1}{N} \sum_{i=1}^{N} (x_i - \mu) \right]
43  + \frac{1}{N} \sum_{i=1}^N \log (x_i - \mu)
44\label{eqn:gamma_tau_root}
45\end{equation}
46
47then using that to obtain $\hat{\lambda}$:
48
49\begin{equation}
50\hat{\lambda} = \frac{N \hat{\tau}} {\sum_{i=1}^{N} (x_i - \mu)}
51\end{equation}
52
53Equation~\ref{eqn:gamma_tau_root} decreases as $\tau$ increases.
54