Consider a variable that can take both negative and positive values, and that has the following density plot:

enter image description here

I am trying to identify the distribution of this variable. The density plot resembles that of a Gamma distribution. However, since the variable can take negative values, it certainly does not follow a Gamma distribution.

What is the best guess as to the distribution of this variable? Of course, the next step would be to plot a QQ plot of the sample quantiles v.s. the theoretical quantiles of the "guessed" distribution.

Any help would be appreciated. Thank you!

  • 1
    $\begingroup$ If the issue is the fact that your data can have negative values, well can't just shift it to the right? It seems like that your function has compact support on the left, this facilitate your work. $\endgroup$ – IcannotFixThis Apr 15 '14 at 14:47
  • $\begingroup$ Do you have any theoretical basis for the expected density or are you just trying to fit any distribution to your data? Also, what do you want to do/conclude once you have this distribution? Last, how much data does this graph represent? $\endgroup$ – Wayne Apr 15 '14 at 15:40
  • $\begingroup$ The variable we are looking at here is a gamma variable from which I have substracted the mean, and divided by the standard deviation. Therefore, I am trying to identify the distribution of a "standardized" gamma variable. A total of N=8234 points are used to estimate the density plot. The end purpose of this analysis is to fit a PDF, so that I can identify any outliers using QQ plot. $\endgroup$ – Mayou Apr 15 '14 at 15:42
  • $\begingroup$ Generally speaking, there's no such thing as "the best guess" without a very explicit and detailed definition of what 'best' means. There may be many reasonable approximations of the distribution. However, in this case we know what we have - it's a gamma sample standardized by its own sample mean and standard deviation. You can simulate the distribution of the quantiles of that to any desired level of accuracy. If you had and explicit functional form for the density of that, what would you do with it? $\endgroup$ – Glen_b -Reinstate Monica Apr 15 '14 at 20:16

A gamma distribution that is standardized as you describe can still be thought of as a gamma distribution if we include a third parameter for the location (starting point).

That is, suppose $X \sim \mathrm{Gamma}(k,\theta),$ where $k$ is the shape parameter and $\theta$ is the scale parameter (this is the same as Wikipedia's first parameterization for a gamma distribution).

Let $Y=X-\mu,$ where $\mu=k\theta$ is the mean of $X.$ Then $Y \sim \mathrm{Gamma}(k,\theta,-\mu),$ where the $-\mu$ indicates the distribution starts at $-\mu$ rather than at $0.$

Finally, let $Z = {{X-\mu} \over {\sigma}},$ where $\sigma = \sqrt{k} \theta,$ the standard deviation of $X.$ Then $Z \sim \mathrm{Gamma}\left(k,{\theta \over \sigma},{-\mu \over \sigma}\right).$ This can be simplifed to $Z \sim \mathrm{Gamma}\left(k,{1 \over \sqrt{k}},{-\sqrt{k}}\right) $

Your case may differ since it appears you used sample mean and sample standard deviation to do your standardization rather than population parameters. But the same method applies - if you started with gamma variates, you still have gamma variates - just shifted and scaled.

  • $\begingroup$ Brief follow-up question: can you add two gamma variables that have different location parameters? $\endgroup$ – Mayou Apr 16 '14 at 12:37
  • $\begingroup$ It works if the scale parameters are the same. So if $z_i \sim \mathrm{Gamma}(k_i, \theta,\mu_i)$ and the $z_i$ are independent, then $Z=\sum{z_i} \sim \mathrm{Gamma}(\sum{k_i},\theta,\sum{\mu_i}).$ $\endgroup$ – soakley Apr 16 '14 at 13:23
  • $\begingroup$ Thanks a lot. This is very helpful. Just a quick check: are you sure that when you standardize the gamma variable, the location parameter should be divided by $\sigma$? $\endgroup$ – Mayou Apr 16 '14 at 13:27
  • $\begingroup$ Imagine a gamma random variable with minimum value (location parameter) of 1. Now divide that random variable by 2. The minimum value is now ${1 \over 2}.$ $\endgroup$ – soakley Apr 16 '14 at 13:33
  • 1
    $\begingroup$ Unfortunately I do not know of one. Here is a possibility. I see in the FAdist R package there is a reference given under the gamma3 function documentation. It is: Bobee, B. and F. Ashkar, 1991, The Gamma Family and Derived Distributions Applied in Hydrology, Water Resources Publications, Littleton, CO. $\endgroup$ – soakley Apr 16 '14 at 15:03

Are you sure that you need a parametric density function in the first place? If you want to sample from the distribution, I would suggest increasing the bandwidth parameter on the density estimator to make the estimation more smooth. I don't think you should ever be forced to say "this variable follows X parametric distribution" in what you are doing.

You could consider the best density function as the one that minimizes some error metric (MSE, MAE, etc). You would compare each data point of your actual distribution to the parametric density function to get these values. In general, there is no correct density function and you can fit almost any distribution you want to any set of data. Standardizing the variable might be a good idea: subtract the mean and divide by the standard deviation. Or, just shift your variable to the right as per the comment.

  • $\begingroup$ Actually, the variable we are looking at here is a gamma variable from which I have substracted the mean, and divided by the standard deviation. The reason why I need to identify the PDF is that this would allow me to identify outliers (using QQ plot). $\endgroup$ – Mayou Apr 15 '14 at 15:41
  • $\begingroup$ Well, that's one way to identify outliers, but it's just as subjective as looking at the density function and deciding that everything to the right of 4 is an outlier. $\endgroup$ – wcampbell Apr 15 '14 at 15:47
  • $\begingroup$ Well, a more robust way of identifying outliers using the pdf, is that I can use the pdf to find critical values (i.e. threshold). For example, if the pdf is a Chi-Square distribution with 12 degrees of freedom, and I consider any point falling beyond the outer 25% of the distribution to be an outlier, then my tolerance boundary is a chi-square score of 14.84. Therefore, identifying the pdf would allow me to detect (potential) outliers in this fashion. $\endgroup$ – Mayou Apr 15 '14 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.