<p>To answer the question relating to start values for the parameters for use with <code>fitdist</code>:</p>

<blockquote>
  <p>I would like to check for an ex-gaussian distribution fit (GAMLSS package), but the fitdist function ask for "start" parameters and I have no idea how to get them: any help would be much appreciated.</p>
</blockquote>

<p>Where possible, knowledge of the behavior of similar reaction times can be used. This might be particularly helpful when the sample skewness (see below) is not suitable for obtaining starting values, since skewness in particular might be anticipated to reasonably similar across different but related circumstances.</p>

<p>As Jeromy says, start values generally just need to be rough ballpark estimates, so if you have some experience of fits you may be able to supply suitable guesses. But if you don't have any suitable idea, there's still something you can do.</p>

<p>The Wikipedia page on the <a href="https://en.wikipedia.org/wiki/Exponentially_modified_Gaussian_distribution" rel="nofollow noreferrer">ExGaussian distribution</a> offers some possibilities.</p>

<p>Firstly, it gives method-of-moments-related estimators based on the <a href="https://en.wikipedia.org/wiki/Exponentially_modified_Gaussian_distribution#Parameter_estimation" rel="nofollow noreferrer">sample mean, variance and skewness</a> (labelled $m, s^2$, and $\gamma_1$ there): </p>

<p>$${\displaystyle {\hat {\mu }}=m-s\left({\frac {\gamma _{1}}{2}}\right)^{1/3},}$$</p>

<p>$${\displaystyle {\hat {\sigma }^{2}}=s^{2}\left[1-\left({\frac {\gamma _{1}}{2}}\right)^{2/3}\right],}$$</p>

<p>$${\displaystyle {\hat {\tau }}=s\left({\frac {\gamma _{1}}{2}}\right)^{1/3}.}$$</p>

<p>The main thing to note there is that the $\tau$ (scale) parameter there is the same as the $\nu$ parameter in the <code>GAMLSS</code> function <code>exGAUS</code> (and is the inverse of the $\lambda$ rate-parameter in the definition of the distribution at the top of the Wikipedia article). The easy way to do this is by starting with $\hat{\tau}$:</p>

<p>$${\displaystyle {\hat {\tau }}=s\left({\frac {\gamma _{1}}{2}}\right)^{1/3}.}$$</p>

<p>then</p>

<p>$$ \hat {\mu }=m-\hat{\tau}$$</p>

<p>$$\hat {\sigma}^{2}=s^{2}-\hat{\tau}^2\,.$$</p>

<p>However, you need to be careful that you don't end up with implausible values for the parameters which might happen if the sample skewness were negative (leading to an impossible value for $\tau$) or if the sample skewness were very large (perhaps leading to issues with the other two parameters, such as a negative variance) -- this must be checked. </p>

<p>On the other hand problems here should also be seen as a warning; if those things happen with the method of moments, there's strong potential for the likelihood function to not behave nicely as well.</p>

<p>The article also mentions the range of the nonparametric skew (a skewness measure based on the second Pearson skewness), which relates the mean, median and standard deviation. This might be used in place of the moment-skewness (with some suitable modification) to obtain an estimate of the scale parameter of the exponential component.</p>

<p>An alternative would be to look at quantile-matching  (such as a calculation based on a high, low and middling quantile) or at estimates from quantile-based measures of location, scale and skewness, but the quantiles are not in general simple functions of the parameters; the existence of quantile and cdf functions in <code>GAMLSS</code> make this potentially viable as a strategy, however. This would be more complex but more likely to lead to feasible values of the parameters, at least in the case where the skewness is very large.</p>

<hr>

<p>The notion of finding a "best" distribution -- and in particular searching for one with a given set of data -- is not especially useful. No simple distribution will be a perfect fit (no simple model will be exactly correct). Models are useful representations rather than perfect descriptions. If one has a simple model which usually fits fairly well and has some theoretical basis by which its parameters and relationships between distributions based on different estimates can be understood, that's a good reason to use it. We should not be overly concerned about a "best" model for a particular data set so much as an adequate model across a variety of data of similar kinds. </p>

<p>In relation to the title -- fitdist (from package fitdistrplus, or fitdistr in MASS) will give parameter estimates for a fitted distribution but doesn't really tell you whether the fit is good enough for some particular purpose or other (i.e. it doesn't really check the quality of the fit in a practical sense). </p>

CC BY-SA 3.0
2017-04-28T16:37:43.520Z
Thanks for this thorough answer. I checked several candidates distributions for my data. It appears that ex-Gaussian seems to fit best.
The problem is that after, there's no sufficient theoretical background to deal with the two distributions components (gaussian and exponential) : what psychological sense do we attribute (two cognitive process ?) and how do we analyse the ex-gaussian parameters in order to check hypotheses.
Frédéric
CC BY-SA 3.0
2017-04-28T18:20:20.890Z
I can't speak to your own work, but the use of the ExGaussian arose as a theoretical model (but one informed by experiment) for reaction times, as a two-stage model for latency (an exponential stage and a Gaussian stage).  See, for example, Hohle (1965), who describes his reason for including an exponential stage, citing McGill (1963), who concluded on the basis of observation that there was an exponential component to reaction times and that (because of it barely being impacted by stimulus intensity) "...*this component is the time required to make the required motor response*". ... ctd
Glen_b
CC BY-SA 3.0
2017-04-28T18:22:01.193Z
ctd... (contrasting Christie and Luce (1956) who used an exponential decision time). Hohle concludes on on the basis of his experiments that there are two components associated with different processes, and  finds that the ExGaussian fits 32 different distributions of reaction times very well. ... other authors have nominated a particular component for the exponential
Glen_b
CC BY-SA 3.0
2017-04-28T18:31:59.147Z
e.g. Rohrer & Wixted 1994 "*latency distributions were fit well by the ex-Gaussian, suggesting that retrieval includes a brief normally distributed initiation stage followed by a longer exponentially distributed search stage*". On the other hand, Sternberg warns against trying to interpret the exponential as the time for a mental process that accomplishes something unless it can be accomplished "in an instant"
Glen_b
CC BY-SA 3.0
2017-04-28T22:27:38.783Z
Though that particular criticism is at least slightly misplaced; since it wouldn't need to be actually instant, just to have a hard minimum for a given individual (potentially resulting in what's actually shifted exponential even though it wouldn't be possible to estimate that shift -- it would show up in the mean of the other component); the characteristics of the component after that unmeasurable minimum latency would still be interpretable.
Glen_b
CC BY-SA 3.0
2017-05-13T12:54:04.603Z
I very much like Rohrer & Wixted (1994) proposal.
I may have a technical issue : the adjusted distribution lead me with three parameters instead of a whole empirical distribution.
How can I check for effects between conditions ?
I'm using something like a trick : for each of my dependant variables I build one gaussian distrtibution fitting the firsts two ex-Gaussian parameters, and one exponential distribution fitting the last one.
I then use those simulated distributions in linear models for each of the ex-gaussian components.
Is this a correct way to check for effects ?
Frédéric
CC BY-SA 3.0
2017-05-14T01:27:53.780Z
I should clarify my necessarily brief reference in comments -- Rohrer & Wixted '94 is a reference to the *Memory and Cognition* paper rather than say the *Psychonomic Bulletin & Review* one (for all I know there may be others, this isn't my area). But this discussion already seems to have progressed beyond clarifying my answer into the area of new questions. Even as a new question it would need some additional context, though -- you're able to measure two components separately, why would you need the ExGaussian at all?
Glen_b
CC BY-SA 4.0
2019-03-29T17:46:58.093Z
A bit late to the party, but perhaps relevant for future readers ... "what psychological sense do we attribute (two cognitive process ?)" With regard to the exGaussian distribution it's better to be on the cautionary side when attributing the parameters to cognitive processes, see: https://link.springer.com/article/10.3758/PBR.16.5.798
Tiberius
CC BY-SA 3.0
2017-04-27T02:55:50.873Z
2017-04-27T10:17:36.610Z
2017-04-27T10:17:36.610Z
Glen_b
<p>I did a quick google and found the <code>mesgauss</code> function in the <code>retimes</code> package. 
I give a simple example of estimatinat ex-gaussian parameters from sample data.</p>

<pre><code>library(retimes)
rtdata &lt;- c(.5, .7, .3, 1, 2, .5, .55)
retimes::mexgauss(rtdata)
</code></pre>

<p>This returns:</p>

<pre><code>       mu     sigma       tau 
0.2838158 0.2668972 0.5090413 
</code></pre>

<p>Regarding starting values, typically these just need to be ball-park estimates of what the parameters might be.</p>

CC BY-SA 3.0
2017-02-04T07:47:57.783Z
so simple but I'm a newbie in R. exactly what I wanted. I have a better fit with the ex-gauss distribution than with the gamma and log-normal ones, and this is what I expected. Thx.
Frédéric
CC BY-SA 3.0
2017-02-04T14:41:15.323Z
any way to plot separately the gaussian and the exponential components of the fitted distribution ?
Frédéric
CC BY-SA 3.0
2017-02-03T02:10:46.500Z
2017-02-03T02:10:46.500Z
Jeromy Anglim
<p>I have several response times from participants in a mental rotation task.
I'm really puzzled how to get the best distribution model to fit my data. I had checked several ones with the fitdistrplus::fitdist function and have two good candidates (log-normal &amp; gamma).</p>

<p>I would like to check for an ex-gaussian distribution fit (GAMLSS package), but the fitdist function ask for "start" parameters and I have no idea how to get them: any help would be much appreciated.</p>

<statistics>
in R : How to check RT's for ex-gaussian fit with the fitdistrplus package
Frédéric
# in R : How to check RT's for ex-gaussian fit with the fitdistrplus package

(Asked by: username_0 on 2017-02-01)

I have several response times from participants in a mental rotation task.
I'm really puzzled how to get the best distribution model to fit my data. I had checked several ones with the fitdistrplus::fitdist function and have two good candidates (log-normal & gamma).

I would like to check for an ex-gaussian distribution fit (GAMLSS package), but the fitdist function ask for "start" parameters and I have no idea how to get them: any help would be much appreciated.

**Tags:** statistics


---

## 2 answers

### Answer by username_3 on 2017-02-03. Score: 3 | Accepted answer

I did a quick google and found the mesgauss function in the retimes package. 
I give a simple example of estimatinat ex-gaussian parameters from sample data.
library(retimes)
rtdata <- c(.5, .7, .3, 1, 2, .5, .55)
retimes::mexgauss(rtdata)

This returns:
       mu     sigma       tau 
0.2838158 0.2668972 0.5090413 

Regarding starting values, typically these just need to be ball-park estimates of what the parameters might be.

> **Comments:**
> **username_0**: so simple but I'm a newbie in R. exactly what I wanted. I have a better fit with the ex-gauss distribution than with the gamma and log-normal ones, and this is what I expected. Thx.  
> **username_0**: any way to plot separately the gaussian and the exponential components of the fitted distribution ?  

---

### Answer by username_1 on 2017-04-27. Score: 4

To answer the question relating to start values for the parameters for use with `fitdist`:

> I would like to check for an ex-gaussian distribution fit (GAMLSS package), but the fitdist function ask for "start" parameters and I have no idea how to get them: any help would be much appreciated.

Where possible, knowledge of the behavior of similar reaction times can be used. This might be particularly helpful when the sample skewness (see below) is not suitable for obtaining starting values, since skewness in particular might be anticipated to reasonably similar across different but related circumstances.

As Jeromy says, start values generally just need to be rough ballpark estimates, so if you have some experience of fits you may be able to supply suitable guesses. But if you don't have any suitable idea, there's still something you can do.

The Wikipedia page on the [ExGaussian distribution](https://en.wikipedia.org/wiki/Exponentially_modified_Gaussian_distribution) offers some possibilities.

Firstly, it gives method-of-moments-related estimators based on the [sample mean, variance and skewness](https://en.wikipedia.org/wiki/Exponentially_modified_Gaussian_distribution#Parameter_estimation) (labelled $m, s^2$, and $\gamma\_1$ there):

$${\displaystyle {\hat {\mu }}=m-s\left({\frac {\gamma \_{1}}{2}}\right)^{1/3},}$$

$${\displaystyle {\hat {\sigma }^{2}}=s^{2}\left[1-\left({\frac {\gamma \_{1}}{2}}\right)^{2/3}\right],}$$

$${\displaystyle {\hat {\tau }}=s\left({\frac {\gamma \_{1}}{2}}\right)^{1/3}.}$$

The main thing to note there is that the $\tau$ (scale) parameter there is the same as the $\nu$ parameter in the `GAMLSS` function `exGAUS` (and is the inverse of the $\lambda$ rate-parameter in the definition of the distribution at the top of the Wikipedia article). The easy way to do this is by starting with $\hat{\tau}$:

$${\displaystyle {\hat {\tau }}=s\left({\frac {\gamma \_{1}}{2}}\right)^{1/3}.}$$

then

$$ \hat {\mu }=m-\hat{\tau}$$

$$\hat {\sigma}^{2}=s^{2}-\hat{\tau}^2\,.$$

However, you need to be careful that you don't end up with implausible values for the parameters which might happen if the sample skewness were negative (leading to an impossible value for $\tau$) or if the sample skewness were very large (perhaps leading to issues with the other two parameters, such as a negative variance) -- this must be checked.

On the other hand problems here should also be seen as a warning; if those things happen with the method of moments, there's strong potential for the likelihood function to not behave nicely as well.

The article also mentions the range of the nonparametric skew (a skewness measure based on the second Pearson skewness), which relates the mean, median and standard deviation. This might be used in place of the moment-skewness (with some suitable modification) to obtain an estimate of the scale parameter of the exponential component.

An alternative would be to look at quantile-matching (such as a calculation based on a high, low and middling quantile) or at estimates from quantile-based measures of location, scale and skewness, but the quantiles are not in general simple functions of the parameters; the existence of quantile and cdf functions in `GAMLSS` make this potentially viable as a strategy, however. This would be more complex but more likely to lead to feasible values of the parameters, at least in the case where the skewness is very large.

---

The notion of finding a "best" distribution -- and in particular searching for one with a given set of data -- is not especially useful. No simple distribution will be a perfect fit (no simple model will be exactly correct). Models are useful representations rather than perfect descriptions. If one has a simple model which usually fits fairly well and has some theoretical basis by which its parameters and relationships between distributions based on different estimates can be understood, that's a good reason to use it. We should not be overly concerned about a "best" model for a particular data set so much as an adequate model across a variety of data of similar kinds.

In relation to the title -- fitdist (from package fitdistrplus, or fitdistr in MASS) will give parameter estimates for a fitted distribution but doesn't really tell you whether the fit is good enough for some particular purpose or other (i.e. it doesn't really check the quality of the fit in a practical sense).

> **Comments:**
> **username_0**: Thanks for this thorough answer. I checked several candidates distributions for my data. It appears that ex-Gaussian seems to fit best. The problem is that after, there's no sufficient theoretical background to deal with the two distributions components (gaussian and exponential) : what psychological sense do we attribute (two cognitive process ?) and how do we analyse the ex-gaussian parameters in order to check hypotheses.  
> **username_1**: I can't speak to your own work, but the use of the ExGaussian arose as a theoretical model (but one informed by experiment) for reaction times, as a two-stage model for latency (an exponential stage and a Gaussian stage).  See, for example, Hohle (1965), who describes his reason for including an exponential stage, citing McGill (1963), who concluded on the basis of observation that there was an exponential component to reaction times and that (because of it barely being impacted by stimulus intensity) "...*this component is the time required to make the required motor response*". ... ctd  
> **username_1**: ctd... (contrasting Christie and Luce (1956) who used an exponential decision time). Hohle concludes on on the basis of his experiments that there are two components associated with different processes, and  finds that the ExGaussian fits 32 different distributions of reaction times very well. ... other authors have nominated a particular component for the exponential  
> **username_1**: e.g. Rohrer & Wixted 1994 "*latency distributions were fit well by the ex-Gaussian, suggesting that retrieval includes a brief normally distributed initiation stage followed by a longer exponentially distributed search stage*". On the other hand, Sternberg warns against trying to interpret the exponential as the time for a mental process that accomplishes something unless it can be accomplished "in an instant"  
> **username_1**: Though that particular criticism is at least slightly misplaced; since it wouldn't need to be actually instant, just to have a hard minimum for a given individual (potentially resulting in what's actually shifted exponential even though it wouldn't be possible to estimate that shift -- it would show up in the mean of the other component); the characteristics of the component after that unmeasurable minimum latency would still be interpretable.  
> **username_0**: I very much like Rohrer & Wixted (1994) proposal. I may have a technical issue : the adjusted distribution lead me with three parameters instead of a whole empirical distribution. How can I check for effects between conditions ? I'm using something like a trick : for each of my dependant variables I build one gaussian distrtibution fitting the firsts two ex-Gaussian parameters, and one exponential distribution fitting the last one. I then use those simulated distributions in linear models for each of the ex-gaussian components. Is this a correct way to check for effects ?  
> **username_1**: I should clarify my necessarily brief reference in comments -- Rohrer & Wixted '94 is a reference to the *Memory and Cognition* paper rather than say the *Psychonomic Bulletin & Review* one (for all I know there may be others, this isn't my area). But this discussion already seems to have progressed beyond clarifying my answer into the area of new questions. Even as a new question it would need some additional context, though -- you're able to measure two components separately, why would you need the ExGaussian at all?  
> **username_2**: A bit late to the party, but perhaps relevant for future readers ... "what psychological sense do we attribute (two cognitive process ?)" With regard to the exGaussian distribution it's better to be on the cautionary side when attributing the parameters to cognitive processes, see: https://link.springer.com/article/10.3758/PBR.16.5.798  

---

