# Obtaining a log-normal waiting time via sequential exponential or gamma distributions - is it possible?

Assume you've use a accelerated failure time model to find that the transition of subjects from State A to State B is log-normally distributed with parameters $\mu$ = X and $\sigma$ = Y.

This now needs to be used in a differential equation model as the rate at which subjects move from State A to State B. However, just using $\mu$ as the average probability of moving from A to B results in an exponentially distributed waiting time, not a log-normally distributed time.

I know you can however use a series of sequential independent exponential distributions to obtain an overall gamma distributed waiting time. For example, if it takes 2 days to move from A to B, four equally spaced exponential distributions results in an overall gamma distributed waiting time with $\kappa$ = 4 and $\theta$ = 2.

The question is, is there a gamma distribution whose shape and scale parameters approximate a log-normal? I know if I used many exponential distributions for a high $\kappa$ the central limit theorem allows the gamma distribution to approximate a log-normal, but I'm not sure if there's a way to obtain a log-normal waiting time from that. Essentially, is there some $\kappa$ and some $\theta$ that yields something approximating a log-normal with $\mu$ = X and $\sigma$ = Y?

• You could do moment-matching on the lognormal and gamma distribution to find a gamma that approximates it. It will probably be ugly and it might not work particularly well. Commented Jan 18, 2013 at 22:22
• Wouldn't you just minimise the KL divergence - which is essentially moment matching on $E_{Ga}\left[\log(x)\right]=\mu$ and $E_{Ga}\left[\log(x)\log(x)\right]=\sigma^2+\mu^2$? Commented Jan 21, 2013 at 13:03
• @probabilityislogic If you wanted to expand this out a bit, it might serve as an answer? Commented Jan 22, 2013 at 17:01
• Let me mention the general collection of phase type distributions (which has sums of exponentials $-$ or Erlang distributions $-$ as special cases). See Fitting Phase-Type Distributions via the EM Algorithm by Asmussen et al., who treat this class of distributions and show, among other things, how to approximate log-normal distributions.
– NRH
Commented Jan 22, 2013 at 21:19
• @NHR Why did you move your answer into being a comment? I'm currently reading the paper you linked and it shows promise. Commented Jan 23, 2013 at 0:02

As mentioned in my comment, a way to approximate the log-normal by a gamma distribution is through the use of the KL-divergence.  That is, we choose the parameters of the gamma distribution to minimise

$$KL(\kappa,\theta)=\int_{0}^{\infty}p(z|\mu,\sigma)\log\left(\frac{p(z|\mu,\sigma)}{q(z|\kappa,\theta)}\right)dz$$

Where $p(z|\mu,\sigma)$ is the log-normal density, and $q(z|\kappa,\theta)$ is the gamma density.  Let $C(\mu,\sigma)$ denote the terms which don't depend on $\kappa,\theta$ we have:

$$KL(\kappa,\theta)=C(\mu,\sigma)+\log[\Gamma(\kappa)]+\kappa\log(\theta)-(\kappa-1)E_p[\log(z)]+\frac{1}{\theta}E_p[z]$$

Taking derivatives gives the following equations to be solved:

$$\psi^{(0)}(\kappa)+\log(\theta)=E_p[\log(z)]=\mu$$ $$\kappa\theta=E_p[z]=\exp\left(\mu+\frac{1}{2}\sigma^2\right)$$

Where $\psi^{(m)}(x)$ is the polygamma function. These are not solvable analytically, although we can eliminate $\theta$ and we have:

$$\kappa= \exp\left(\psi^{(0)}(\kappa)+\frac{1}{2}\sigma^2\right)$$

A starting value can be obtained by using the approximation $\psi^{(0)}(\kappa)\approx\log(\kappa)-(2\kappa)^{-1}$ which gives $\kappa\approx\sigma^{-2}$. This approximation gets better for smaller values of $\sigma^2$.

Choosing this KL-divergence ensures that the log-likelihood ratio between p and q is small near the regions of high density in the exact log-normal distribution.

Doing the divergence the other way $q\log\left(\frac{q}{p}\right)$ results in the log-likelihood ratio is small near the regions of high density in $q$.  This is known as Variational Bayes (although it is a non-standard application of it) and will typically understate the variance of the exact distribution. This results in the moment matching I gave in the comments. So the new equations to be solved are

$$\psi^{(0)}(\kappa)+\log(\theta)=\mu$$ $$\kappa\psi^{(1)}(\kappa)+\frac{\psi^{(2)}(\kappa)}{2\sigma^2}=1$$

This could be important as the right tail of a gamma are lighter than a log-normal - $\exp(-az)$ compared to $\exp(-b[\log(z)]^2)$. To see this we get the same approximation (differentiating the approximation to the digamma function) for $\theta$ given the value of $\kappa$ but now $\kappa\approx\frac{1+\sqrt{1+4\sigma^2}}{2\sigma^2}>\sigma^{-2}$ - that is we have decreased the coefficient of variation compared to using the KL divergence used initially (which is also understated as the exact inverse of the squared CV is $\frac{1}{\exp(\sigma^2)-1}$).

• Thank you for the detailed answer - is there any chance you know of a clean way to implement this in something like R such that is doesn't need to be done by hand - or can be used repeatedly? Commented Jan 22, 2013 at 23:51
• (+1) especially for explaining the difference between minimizing KL-divergence one way or the other. @EpiGrad, something like uniroot(function(k) k - exp(psigamma(k) + 1), c(0.01, 10)) will solve the equation numerically (here with $\sigma^2 = 2$) in R.
– NRH
Commented Jan 23, 2013 at 7:49
• So if we use the code @NRH provides to find a value of k, could that be fed back into ψ(0)(κ)+log(θ)=μ in order to find θ? Commented Jan 23, 2013 at 10:48