# Exponentially modified Gaussian distribution

In probability theory, an exponentially modified Gaussian distribution (EMG, also known as exGaussian distribution) describes the sum of independent normal and exponential random variables. An exGaussian random variable Z may be expressed as Z = X + Y, where X and Y are independent, X is Gaussian with mean μ and variance σ$^2$, and Y is exponential of rate λ. It has a characteristic positive skew from the exponential component.
It may also be regarded as a weighted function of a shifted exponential with the weight being a function of the normal distribution.

## Definition

The probability density function (pdf) of the exponentially modified Gaussian distribution is
    $f(x;\mu ,\sigma ,\lambda )={\frac {\lambda }{2}}\exp \left[{\frac {\lambda }{2}}(2\mu +\lambda \sigma ^{2}-2x)\right]\operatorname {erfc} \left({\frac {\mu +\lambda \sigma ^{2}-x}{{\sqrt {2}}\sigma }}\right),$
where erfc is the complementary error function defined as
    ${\begin{aligned}\operatorname {erfc} (x)&=1-\operatorname {erf} (x)\\&={\frac {2}{\sqrt {\pi }}}\int _{x}^{\infty }e^{-t^{2}}\,dt.\end{aligned}}$
This density function is derived via convolution of the normal and exponential probability density functions.

## Alternative forms for computation

An alternative but equivalent form of the EMG distribution is used to describe the shape of the peak in chromatography. This is as follows
where
    $h$ is the amplitude of Gaussian,
    $\tau ={\frac {1}{\lambda }}$ is exponent relaxation time, $\tau ^{2}$ is a variance of exponential probability density function.
This function cannot be calculated for some values of parameters (for example, $\tau =0$) because of arithmetic overflow. Alternative, but equivalent form of writing the function was proposed by Delley:
where $\operatorname {erfcx} t=\exp t^{2}\cdot \operatorname {erfc} t$ is a scaled complementary error function
In the case of this formula arithmetic overflow is also possible, region of overflow is different from the first formula, except for very small τ.
For small τ it is reasonable to use asymptotic form of the second formula:
Decision on formula usage is made on the basis of the parameter $z={\frac {1}{\sqrt {2}}}\left({\frac {\sigma }{\tau }}-{\frac {x-\mu }{\sigma }}\right)$:
    for z < 0 computation should be made according to the first formula,
    for 0 ≤ z ≤ 6.71·10$^7$ (in the case of double-precision floating-point format) according to the second formula,
    and for z > 6.71·10$^7$ according to the third formula.
Mode (position of apex, most probable value) is calculated using derivative of formula 2; the inverse of scaled complementary error function erfcxinv is used for calculation. Approximate values are also proposed by Kalambet et al. Though the mode is at a value higher than that of the original Gaussian, the apex is always located on the original (unmodified) Gaussian.

## Parameter estimation

There are three parameters: the mean of the normal distribution (μ), the standard deviation of the normal distribution (σ) and the exponential decay parameter (τ = 1 / λ). The shape K = τ / σ is also sometimes used to characterise the distribution. Depending on the values of the parameters, the distribution may vary in shape from almost normal to almost exponential.
The parameters of the distribution can be estimated from the sample data with the method of moments as follows:
    $m=\mu +\tau ,$
    $s^{2}=\sigma ^{2}+\tau ^{2},$
    $\gamma _{1}={\frac {2\tau ^{3}}{(\sigma ^{2}+\tau ^{2})^{3/2}}},$
where m is the sample mean, s is the sample standard deviation, and γ$_1$ is the skewness.
Solving these for the parameters gives:
    ${\hat {\mu }}=m-s\left({\frac {\gamma _{1}}{2}}\right)^{1/3},$
    ${\hat {\sigma ^{2}}}=s^{2}\left[1-\left({\frac {\gamma _{1}}{2}}\right)^{2/3}\right],$
    ${\hat {\tau }}=s\left({\frac {\gamma _{1}}{2}}\right)^{1/3}.$

### Recommendations

Ratcliff has suggested that there be at least 100 data points in the sample before the parameter estimates should be regarded as reliable. Vincent averaging may be used with smaller samples, as this procedure only modestly distorts the shape of the distribution. These point estimates may be used as initial values that can be refined with more powerful methods, including a least-squares optimization, which has shown to work for the Multimodal Exponentially Modified Gaussian (MEMG) case. A code implementation with analytical MEMG derivatives and an optional oscillation term for sound processing is released as part of an open-source project.

### Confidence intervals

There are currently no published tables available for significance testing with this distribution. The distribution can be simulated by forming the sum of two random variables one drawn from a normal distribution and the other from an exponential.

### Skew

The value of the nonparametric skew
    ${\frac {{\text{mean}}-{\text{median}}}{\text{standard deviation}}}$
of this distribution lies between 0 and 0.31. The lower limit is approached when the normal component dominates, and the upper when the exponential component dominates.

## Occurrence

The distribution is used as a theoretical model for the shape of chromatographic peaks. It has been proposed as a statistical model of intermitotic time in dividing cells. It is also used in modelling cluster ion beams. It is commonly used in psychology and other brain sciences in the study of response times. In a slight variant where the mean of the Normal component is set to zero, it is also used in Stochastic Frontier Analysis, as one of the distributional specifications for the composed error term that models inefficiency. In signal processing, EMGs have been extended to the multimodal case with an optional oscillation term to represent digitized sound signals.

## Related distributions

This family of distributions is a special or limiting case of the normal-exponential-gamma distribution. This can also be seen as a three-parameter generalization of a normal distribution to add skew; another distribution like that is the skew normal distribution, which has thinner tails. The distribution is a compound probability distribution in which the mean of a normal distribution varies randomly as a shifted exponential distribution.
A Gaussian minus exponential distribution has been suggested for modelling option prices. If such a random variable Y has parameters μ, σ, λ, then its negative -Y has an exponentially modified Gaussian distribution with parameters -μ, σ, λ, and thus Y has mean $\mu -{\tfrac {1}{\lambda }}$ and variance $\sigma ^{2}+{\tfrac {1}{\lambda ^{2}}}$.