Exponentially modified Gaussian (ex-Gaussian) distributions

Version 1.2.0.4 (3.23 KB) by Anton
exGaussian distribution (pdf and rand); difference of exGaussian-distributed random variables (pdf)
775 Downloads
Updated 24 May 2019

View License

Exponentially modified Gaussian (exGaussian) distribution describes the sum of independent normal and exponential random variables.
This distribution was proposed as a model for the shape of chromatographic peaks [1] and is also used in psychology, psychophysiology and neuroscience as a model of reaction times [2-4].
Let us consider reaction times as an example. Overall reaction time can be partitioned into two components [2, Chapter 4], [4]:
- time taken to decide upon a response (“decision component”);
- time taken to perceive the stimulus and to physically perform the response (“transduction component”)
Transduction component can be modelled by normal distribution with a mean of mu and a standard deviation of sigma. Decision component can be modelled by exponential distribution with a mean of tau. Then the overall reaction time is modelled by exGaussian with parameters mu, sigma and tau.

This submission contains three functions dealing with exGaussian distribution:
- exgauss_rnd.m generates exGaussian random numbers;
- exgauss_pdf.m computes the probability density function (pdf) of the exGaussian distribution (for example, if after you have estimated parameters of exGaussian distribution for your data using exgauss_fit, you can use exgauss_pdf to plot histogram of your data along with theoretical distribution);
- exgauss_diff_pdf.m computes the pdf of the difference of two exGaussian-distributed random variables (for example, assume that in your study to participant respond to the same stimuli. If you know exGaussian distributions behind reaction times of the participants of a study, you can use exgauss_diff_pdf to compute distribution of lags in participants’ reaction times, see example below).
Fitting exGaussian distribution (estimating parameters of exGaussian distribution underlying provided data) was described in [5], corresponding functions can be found at [6];

EXAMPLE of use:
m1 = 3; std1 = 1.0; tau1 = 1; %parameters of reaction time for Participant 1
m2 = 2; std2 = 0.5; tau2 = 2; %parameters of reaction time for Participant 2
% generate distributions of reaction times (rt)
x = 0:0.001:9;
rt1 = exgauss_pdf(x, m1, std1, tau1);
rt2 = exgauss_pdf(x, m2, std2, tau2);

% generate distributions of reaction time difference (time gap between responses of Participants 1 and 2)
dltX = -7:0.001:6;
dRT = exgauss_diff_pdf(dltX, m1,std1,tau1,m2,std2,tau2);

figure
LineWidth = 2;
subplot(2,1,1) % plot rt distribution
hold on
plot (x, rt1, 'b-', 'linewidth', LineWidth);
plot (x, rt2, 'r-', 'linewidth', LineWidth);
hold off;
axis( [0.4, max(x), 0, 1.05*max(rt1)] );

subplot(2,1,2) % plot rt-difference distribution
plot (dltX, dRT, 'm-', 'linewidth', LineWidth);
axis( [min(dltX), max(dltX), 0, 1.05*max(dRT)] );

REFERENCES:
[1] Grushka E. (1972). Characterization of Exponentially Modified Gaussian Peaks in Chromatography. Analytical Chemistry. 44 (11): 1733–1738.
[2] Luce R.D. (1986). Response Times: Their Role in Inferring Elementary Mental Organization. Oxford University Press.
[3] Ratcliff R. (1993). Methods for Dealing with Reaction Time Outliers. Psychological Bulletin 114 (3): 510-532
[4] Dawson, M.R. (1988). Fitting the ex-Gaussian equation to reaction time distributions. Behavior Research Methods, Instruments, & Computers, 20(1): 54-57.
[5] Lacouture Y, Cousineau D. How to use MATLAB to fit the ex-Gaussian and other probability functions to a distribution of response times. Tutorials in Quantitative Methods for Psychology. 2008;4(1):35-45.
[6] https://github.com/ElsevierSoftwareX/SOFTX-D-16-00127. Accessed: 02.11.2018

Cite As

Unakafov A.M. (2019). Exponentially modified Gaussian (ex-Gaussian) distributions (https://www.mathworks.com/matlabcentral/fileexchange/66575), MATLAB Central File Exchange. Retrieved February 21, 2019.

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Frequently-used Algorithms in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.2.0.4

A misprint (resulting in errors for Symbolic Math Toolbox users) is corrected

1.2.0.3

Risc of numerical instability in the exGaussian PDF computation (exgauss_pdf) has been mitigated

1.2.0.2

Description updated

1.2.0.1

Description updated

1.2.0.0

Description updated

1.1.0.0

Description updated

1.0.0.0