Talk:Gamma distribution

From Wikipedia, the free encyclopedia
  (Redirected from Talk:Gamma distribution/Comments)
Jump to: navigation, search
WikiProject Statistics (Rated B-class, High-importance)
WikiProject icon

This article is within the scope of the WikiProject Statistics, a collaborative effort to improve the coverage of statistics on Wikipedia. If you would like to participate, please visit the project page or join the discussion.

B-Class article B  This article has been rated as B-Class on the quality scale.
 High  This article has been rated as High-importance on the importance scale.
WikiProject Mathematics (Rated B-class, High-importance)
WikiProject Mathematics
This article is within the scope of WikiProject Mathematics, a collaborative effort to improve the coverage of Mathematics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Mathematics rating:
B Class
High Importance
 Field: Probability and statistics
One of the 500 most frequently viewed mathematics articles.

KL Divergence[edit]

Anyone mind if I rephrase the Kullback-Leibler Divergence? The pdf is defined above in terms of shape k and scale theta, but the KL divergence uses theta as shape, and inverse scale beta = theta^-1. Pretty confusing. — Preceding unsigned comment added by (talk) 20:45, 21 September 2011 (UTC)

Important Expectations[edit]

I've found it important to know some expectations which I couldn't find on this page. For example, for the inverse scale parametrization,

Where should this expectation go? Bazugb07 (talk) 16:58, 20 May 2009 (UTC)

Implementing cdf[edit]

So I'm trying to get the cdf into gnuplot to generate a graph except it's not working right

cgamma(x,k,t) = igamma(k, x/t) / gamma(k)

set xtics 0,2
set ytics 0,0.1
set samples 1001
set terminal postscript enhanced color solid lw 2 "Times-Roman" 27
set output

plot [0:100] \
    cgamma(x,1,2) title "{/Times-Italic k} = 1, {/Symbol q} = 2", \
    cgamma(x,2,2) title "{/Times-Italic k} = 2, {/Symbol q} = 2", \
    cgamma(x,3,2) title "{/Times-Italic k} = 3, {/Symbol q} = 2", \
    cgamma(x,4,2) title "{/Times-Italic k} = 4, {/Symbol q} = 2", \
    cgamma(x,5,2) title "{/Times-Italic k} = 5, {/Symbol q} = 2", \
    cgamma(x,5,.5) title "{/Times-Italic k} = 5, {/Symbol q} = 0.5"

but this doesn't give me the correct plots

  • the first two tend to 1
  • third tends to 0.5
  • fourth tends to like .175
  • fifth & sixth tend to the same value at about 0.05

The cgamma function above is the incomplete gamma function over the gamma shown in the article. Which is wrong: the cdf in the article or my gnuplot setup? Cburnett 09:00, 10 Mar 2005 (UTC)

I use the following gnuplot definitions (using names similar to those used by R/Splus):
_ln_dgamma(x, a, b) = a*log(b) - lgamma(a) + (a-1)*log(x) - b*x
dgamma(x, shape, rate) =\
 (x<0)? 0 :\
 (x==0)? ((shape<1)? 1/0 : (shape==1)? rate : 0) :\
 (rate==0)? 0 :\
 exp(_ln_dgamma(x, shape, rate))
pgamma(x, shape, rate) = (x<0)? 0 : igamma(shape, x*rate)
The problem is that "incomplete gamma function" is ambiguous, referring sometimes to the regularized incomplete gamma function. --MarkSweep 16:50, 10 Mar 2005 (UTC)

PDF/CDF confusion[edit]

Ok, so I wrote gnuplot code taken directly from the pdf listed in the article. It's under commons:Image:Gamma distribution pdf.png (see the cdf as well that uses MarkSweep's code from above) but if I take your pdf implementation I get much different curves. The CDF drastically does not agree (see yellow line).

If I can't take the PDF & CDF from the article and get correct plots then I think we need to change the article (even if it's gnuplot that's wrong and explain how some plotters could implement, say, the incomplete gamma function differently). Cburnett 19:47, 10 Mar 2005 (UTC)

I was just about to point out that the PDFs visually don't integrate to the CDFs. I also realize that the gnuplot snippet I posted above uses the same parameterization that R uses, which I suspect is different from the first parameterization used in the article. There is always the issue whether one should use a scale parameter directly or use its inverse instead. I suspect that's the underlying confusion here. --MarkSweep 20:07, 10 Mar 2005 (UTC)
Ah, there we go. I was using theta and you were using beta. I inverted the rate parameter and got the matching CDF. Uploading new one. Cburnett 20:13, 10 Mar 2005 (UTC)
There. *sigh* Finally. :) Cburnett 20:23, 10 Mar 2005 (UTC)
Aargh. I was working on the same plots and just replaced both your versions with new matching PDFs and CDFs. Note that the width is now 1300px, so that scaling it down to 325px will be easier or look better. I used fewer examples to avoid cyan-on-white and yellow-on-white. --MarkSweep 20:40, 10 Mar 2005 (UTC)
Related to this, the mgf is expressed in terms of alpha and beta too. What do you think of adding a note about alternative parameterizations and their uses (see e.g. the more convenient parameterization in Exponential distribution#Bayesian inference)? --MarkSweep 20:47, 10 Mar 2005 (UTC)
mgf updated to match the rest. I don't really care what parameterization we use as long as it's consistent. I prefer greek letters for paramters (just cuz I guess....) so I'd go for the alpha/beta notation over the k/theta. Either way.... More plots to generate if we change it. Cburnett 21:44, 10 Mar 2005 (UTC)

alternative parameterization[edit]

Isn't there an altertanative parameterization for the gamma? Is there a general method wikipedia deals with these? --Pdbailey 17:47, 16 Apr 2005 (UTC)

Okay, foot in mouth... I was confused. --Pdbailey 18:04, 16 Apr 2005 (UTC)

There is in fact an alternative parametrization ... but I'm too lazy to look it up now. Rp 01:46, 6 May 2006 (UTC)

Too bad. C++ manual uses alpha and beta in place of $k$ and $\theta$. — Preceding unsigned comment added by (talk) 10:34, 26 June 2015 (UTC)

Relation to maxwell-bolzmann[edit]

I removed the following text which doesn't make any sense: " is a Maxwell-Boltzmann distribution if ." I couldn't figure out how to fix it by reading Maxwell-Boltzmann distribution A5 23:13, 16 April 2006 (UTC)

It's fixed (but check it, please). PAR 00:30, 17 April 2006 (UTC)

Real-world examples[edit]

It would be interesting to see some real-world examples of gamma distributions; the article is a bit technical at the moment. It would also be nice to learn why they might be distributed in that way. I know for instance that reaction times in psychological experiments are usually gamma-distributed (rather than the normal distribution that is assumed in the statistical tests based on them) but I'm not sure why. Junes 10:30, 25 May 2006 (UTC)

Yes, more insight into the function in plain language (vs formulae) would be very nice!
Gamma distribution is used to model claim severity in the general insurance industry 11:41, 20 February 2007 (UTC)
I also would like more plain language on what generates such distributions and when they are found. Some can be found in the Wikipedia article on the exponential distribution which is a special case of the gamma. It is dscribed as the natutal distribution of intervals between events that occur at a constant random rate(for example, phone calls within a certain period where the rate is steady. Timothy Mak on the AllStat list has also told me that gamma is the expected distribution of time until Bold textnBold text events have occurred.
Also on the AllStat list(in the archive) I have read that on "theoretical grounds" the distribution of rates of return across companies could be Bold textexpectedBold text to be gamma distributed.
I also have read James V. Bradley's article on the "L-shaped" distribution of response times, among other things, and the implications for normality-assuming statistics. Of course some just assume that the Bold textsamplingBold text distribution, the distribution of sample means around the population one, is normal, which is often true even when the actual data are distributed nonnormally. I have also heard of the insurance example.
I am currently working with an L-shaped distribution of the number of times a court case is "distinguished" to those it is "folllowed". I think it might be a gamma, and specifically an exonential, distribution, but am having trouble finding a way to test this hypothesis.
Yours Sincerely,
Alan E. Dunne24.235.165.89 15:32, 26 March 2007 (UTC)
Kotz and Norman Lloyd Johnson in Continuous Univariate Distributions 1970, chapter 17, give several examples Of the "time-to-event" and "insured casualty" types and also fibre-diameter measurements of wool tops, "internal comparisons in multipurpose experiments" and unspecified "medical applications"
Yours Sincerely,
Alan E. Dunne24.235.165.89 15:45, 2 April 2007 (UTC), With Respect
Further work with my ratio of court citation types has shown that it does not approximate the exponential but rather a gamma distribution with k less than 1 (a bit more than 0.5) I would be interested to hear what this might mean
Yours Sincerely
Alan E. Dunne

Cite? Approximation when some x = 0?[edit]

The approximation provided for k is very useful in general, but what is one to do when , for some i?

Also, it would be nice to have a cite, here, but neither of the listed references has this formula, AFAICT.

Ken K 30 Oct 2006

Theta or 1/theta ?[edit]

To me it seems that the in the probability density function we should have instead of since all the other characteristics that are shown seem to be calculated with . I checked to verify this but I would be happier if a more experienced wiki-editor/mathematician changed the article. Sorry if I am incorrect about this.

Artagas 20 Nov 2006

Both parameterizations exist, and both are already covered in the article (someone introduced a mistake recently, now corrected). In the first version, with parameters , the parameter θ is a scale parameter. The second parameterization, in terms of , uses an inverse scale parameter and has advantages when the Gamma distribution is used as a conjugate prior (see e.g. exponential distribution#Bayesian inference). --MarkSweep (call me collect) 02:59, 20 November 2006 (UTC)

Graphs of pdf misleading[edit]

The graph presented on the main page for k=1, is misleading. The function actually diverges to infinitiy as x tends to zero under these parameters. This is an interesting property of the gamma distrubution and should be indicated in the graph.

isn't it just an exponential distribution in the case of k=1? (in other words, what you say is not true.) MisterSheik 02:07, 27 March 2007 (UTC)

Confusion about parameter names[edit]

With Respect

In the article gamma is a function of x, k, and theta, or alternatively paramtrized by alpha and beta but there seem to be many other names floating around. Gammma is sometimes said to have parameters r and lambda, or n and lambda. I have seen alpha and beta called A and B. There is also a 1/lambda parameter. Which of alpha or beta is 1/theta is and which parameter equals one are also sources of confusion. I have also seem k(I think) called kappa.
There are also references on the Allstat list and elsewhere to "three-parameter gamma" and a constant a.
Yours Sincerely,
Alan E. Dunne 15:55, 2 April 2007 (UTC)

They're just different names of the same things. Except, three-parameter gamma, which just has a location parameter, and is a trivial modification. I think it would be more confusing to include it. MisterSheik 17:44, 17 April 2007 (UTC)

infinitely divisible[edit]

It would be nice to add that the Gamma distribution is infinitely divisible, and to provide its L\'evy measure

Yes... MisterSheik 17:12, 17 April 2007 (UTC)

exponential family[edit]

In the article it says

The Gamma distribution is a two-parameter exponential family ...

Shouldn't it rather be "... is a one-parameter exponential family ..." ? I am aware that the Gamma distribution itself has two parameters, but in the context of exponential families, the number of parameters has a different meaning, in my opinion. Unfortunately this distinction is not made in the article on exponential families (maybe it should be?). Can another mathematician/statistician verify this? 14:37, 17 April 2007 (UTC)

No, the exponential family also has two parameters :) MisterSheik 17:06, 17 April 2007 (UTC)
Yes, meanwhile I noticed that too. I apologize for my mistake, I got confused by a particular setting where one of the parameters was considered a nuisance parameter, effectively making it a one parameter exponential family. Sorry again. -- 12:30, 18 April 2007 (UTC)
No worries... :) MisterSheik 12:41, 18 April 2007 (UTC)


It would be useful if the images at the top of the page would include variations of θ for constant k. Currently, no two curves have the same k value. --EyrianAtWork 13:50, 11 July 2007 (UTC)

I disagree. θ is a scale parameter, and the curve doesn't change shape with θ. A plot in the scale parameter article might be useful though. -- Aastrup 20:19, 18 July 2007 (UTC)
I agree with @EvrianAtWork, I think at least on of the curves having the same k value would be helpful since a beginner might not exactly know what's meant by a "scale parameter", but will easily see the effect of changing θ if it was shown. Monsterman222 (talk) 06:53, 29 July 2014 (UTC)

Gamma or Γ?[edit]

I must admit that most of my Statistics books aren't written in English, but when it comes to the two ways of notation

it is clearly the first which is used most often. This is why I'm changing the notation in the article. Aastrup 21:58, 18 July 2007 (UTC)

The use of \Gamma is confusing as it refers to the gamma function either Gamma(a,b) or Ga(a,b) are more common.

Gentry White —Preceding unsigned comment added by (talk) 19:20, 15 July 2008 (UTC)

Do not use the gamma function to refer to a gamma distribution. There are to many dang gamma symbols on the page which makes it confusing which is being referred to. Gammma(a, b) is obviously the most clear. —Preceding unsigned comment added by (talk) 22:08, 7 December 2008 (UTC)

Another plea to restrict to the gamma function (as it's universal throughout mathematics) and use Gamma for the distribution.
A similar thing happens with the beta distribution. Since its parameters are conventionally and , it's just unacceptable to refer to the distribution as ! Much better to write , and similarly (choose your parameters). -- (talk) 23:02, 5 November 2009 (UTC)

The top of the webpage says not to confuse the "Gamma" distribution with the Gamma function. Throughout the webpage, however, the single-parameter function (greek symbol) is used but nowhere is this explained as the "Gamma" function referred to at the top. This should be explained, and a link to the wikipedia page for the Gamma function should be provided. Craniator (talk) 23:34, 17 March 2013 (UTC) — Preceding unsigned comment added by Craniator (talkcontribs) 23:31, 17 March 2013 (UTC)

Proof of some of the basic stuff[edit]

I've made this little example on the page concerning charactericstic functions

The Gamma distribution with scale parameter θ and a shape parameter k has the characteristic function
Now suppose that we have
with X and Y independent from each other, and we wish to know what the distribution of X + Y is. The characteristic functions are

which by indedendence and the basic properties of characteristic function leads to

This is the characteristic function of the gamma distribution scale parameter θ and shape parameter k1 + k2, and we therefore conclude
The result can be expanded to n independent gamma distributed random variables with the same cale parameter and we get

I think it might be nice to have on the gamma districution page a well. Any thoughts? - Aastrup 12:00, 28 July 2007 (UTC)

sir i need some information about statistical distributions[edit]

sir please tell me the applications from real life and some solved examples of {Gamma Distribution,Weibul Dist,and exponential distribution}sir i will b very thank full to you.u can send me these information on "".i will wait ur response. —Preceding unsigned comment added by (talk) 18:48, 20 October 2007 (UTC)

Generating variables[edit]

Can anyone review the changes made by ClaudeLo? I wrote the original algorithm (rather adapted and fixed it based on some book) but no longer study math and my work is not math-related, so I do not quite trust my skills. -- Paul Pogonyshev (talk) 00:04, 22 November 2007 (UTC)

I'm not sure if the current version is these changes, but the current algorithm does not work for me. It consistently generates too many extremely high values. I also can't tell what the point of V1 is in that algorithm; it chooses between two branches, but there should be no need to do that in an acceptance-rejection method.
Here is a quickly hacked together C implementation. It's easily verified due to the simple rejection criterion:
double rand_flat() {
    double val = (double) rand() / (double) RAND_MAX;
    return val;

double gamma(const double k, const double theta)
    double delta = k - trunc(k);
    double x, y;
    bool done = 0;
    do {
        //   Generate x and y — independent uniformly distributed on (0, 1] variables.
        x = rand_flat();
        y = rand_flat();
        // Accept if y < P(x)
        if (y < (pow(x, delta - 1) * exp(-x) / tgamma(delta))) { done = 1; }
    } while (!done);
    double rest = 0;
    for (int i = 0; i < trunc(k); i++) {   
        rest += log(rand_flat());

    double val = (x - rest) / theta;
    return val;

--Dyfrgi (talk) 09:26, 6 January 2010 (UTC)

This code above is bogus for the simple reason that this samples from the area below the probability distribution but assumes that the density lives with the unit square but that's very false. Close to zero the PDF far exceeds 1 and appreciable mass is distributed on x>1. Sorry! —Preceding unsigned comment added by (talk) 05:04, 6 March 2010 (UTC)

Four standard references to reliable algorithms for generating gamma variates have been inserted above the explicit algorithm that is given without proof or source. It does not appear to be the algorithm in Ahrens and Dieter. Can anyone identify a source for the algorithm given? Does the article need to include an explicit (but unsourced) algorithm when one is available in the linked PDF of Ahrens and Dieter? Mathstat (talk) 11:49, 26 February 2012 (UTC)

Parameter Estimation[edit]

Is the MLE parameter estimation for theta wrong? should it be k*xbar instead of xbar/k? -- (talk) 01:41, 19 June 2008 (UTC)

Nah, it seems correct. Recall that the mean = k * theta and is estimated by xbar. So it makes sense that theta is estimated by xbar/k. --Fangz (talk) 11:27, 19 June 2008 (UTC)

I think have found a mistake of the same kind in Chow, V. T. Maidment, D. and Mays, L. W. "Applied Hydrology" 1988. Mc Graw Hill, International Edition. In table 11.5.1 the scale parameter is named lambda and corresponds to the inverse of theta, the scale parameter described in this article. It is stated that the estimator for lamba is sx/sqrt(k), where sx is the standard deviation and k is the shape parameter. Being lambda the inverse of theta, it estimation should be sqrt(k)/sx. Could anyone confirm this? J. (talk) 12:33, 19 December 2008

Reference for entropy[edit]

Can someone post a reference for the entropy computation for the gamma density ? It's mentioned on the side table without a reference. —Preceding unsigned comment added by (talk) 17:55, 13 October 2008 (UTC)

as in the reference from the Differential_entropy article.
Lazo, A. and P. Rathie. On the entropy of continuous probability distributions Information Theory, IEEE Transactions on, 1978. 24(1): p. : 120-122 (talk) 15:54, 26 October 2011 (UTC)

Right margin too near to tables in some math articles[edit]

(Question moved from MediaWiki talk:Common.css; this would have been best asked at the Wikipedia:Help desk)

With Firefox 3.0.7 on Ubuntu, when I look at Gamma distribution, I see that the right margin of the left text column is too near to the right column where the picture and the table are. There should be some more margin between the two columns. --Pot (talk) 08:46, 11 March 2009 (UTC)

This article uses template{{Probability distribution}}. Look at the documentation for the template and you will see it has a parameter for marginleft. I suggest you start with a value of 2em and fudge from there. The default margin is 1em; if you think that should be changed, discuss it on the template talk. --—— Gadget850 (Ed) talk - 10:47, 11 March 2009 (UTC)

Relation to dirac distribution[edit]

I'm pretty sure it shouldn't be in the article, but it's interesting anyway. The Gamma(α,c/α) distribution tends to a dirac distribution centered around c as α->infinity. This is easily visible by taking β=4/α (so that αβ=4), for large α it tends to dirac distribution. (or you can see that the variance is c^2/α, which tends to zero in such a process). —Preceding unsigned comment added by (talk) 13:49, 4 November 2010 (UTC)

Gamma distribution in rainfall analysis[edit]

There is a comment on the main page that a citation is needed in relation to the use of the gamma distribution for rainfall analysis.

There is a good discussion of the use of the gamma distribution to fit monthly rainfall data on p303-307 of Jones et al. (2009)

Jones, O., Maillardet, R. and Robinson, A. (2009) Introduction to scientific programming and simulation using R. CRC Press. [1]

Tony.ladson (talk) 01:29, 1 September 2011 (UTC)


  1. ^ Jones, O., Maillardet, R. and Robinson, A. (2009) Introduction to scientific programming and simulation using R. CRC Press.

Distinguishing between k and alpha[edit]

What's the purpose of using two different letters for the shape parameter in the two different representations of the distribution? I think it just adds clutter.

Domminico (talk) 19:12, 25 April 2012 (UTC)


Rather than waving our swords around showing how clever we are at solving for the MLE under the standard parameterisation, would it not be simpler to present the alpha, mu parameterisation and solve that instead? — Preceding unsigned comment added by (talk) 19:56, 11 October 2012 (UTC)

Relation with Chi Squared[edit]

There is a typo in relations with Chi-Squared distribution, as \theta = \frac 12, but for cX \theta = 2c, which give a contradiction at c=1. Correct version is \theta = 2 — Preceding unsigned comment added by Bitlemon (talkcontribs) 19:15, 3 December 2013 (UTC)

Scaling section[edit]

The Scaling section currently reads:


then for any c > 0,

Hence the use of the term "scale parameter" to describe θ.

Equivalently, if

then for any c > 0,

Hence the use of the term "inverse scale parameter" to describe β.

The second set of equations contradicts the first: the final maths line should read

I'm not sure what correction should be made, though, because I don't know what the point of the "inverse scale parameter" thing was.

Smaug123 (talk) 13:59, 4 February 2014 (UTC)


I find the inconsistency of notation throughout this long article quite confusing at some places. The most significant problem is the mixing of the two different sets of parametrization in different places. For example, in the Related Distribution section, it is often not clear which parametrization is used (e.g. "If X ~ Gamma(1, λ), then X has an exponential distribution with rate parameter λ"). As this article belongs to the area of Probability, I would suggest to preferentially use the α, β parametrization that is much more common in probability and statistics literature and more consistent with other Wikipedia articles on probability distributions (e.g. exponential distribution). Also, α and k are both shape parameter, it will be much clearer to stick with one notation. I would also suggest using α throughout and only use k where the shape parameter is assumed to be an integer (i.e. where Erlang distribution is mentioned). Beside this, log and ln are also used interchangeably in different places. The greek letter \Gamma is used for both the Gamma function and the Gamma distribution, which can be potentially confusing as well.

No explanation or introduction to what the distribution is.[edit]

This piece seems incredibly technical and targeted only at people who already know everything. Nowhere in the article does it mention what the gamma distribution is or what it's used to model. It might be useful to even say what it is before talking about how to parametrize it. There's a tiny applications section at the bottom but it hasn't been updated in 7 years. (talk) 21:23, 12 March 2016 (UTC)

The lede does mention one place it comes up: "If k is a positive integer, then the distribution represents an Erlang distribution; i.e., the sum of k independent exponentially distributed random variables, each of which has a mean of θ." Dicklyon (talk) 01:24, 13 March 2016 (UTC)
I agree. I think it would be helpful to place this fact, and any other simple uses of the distribution, up front before the three ways of parametrizing. Nonstandard (talk) 21:02, 15 May 2016 (UTC)

Main image of probability distributions is incorrect[edit]

the legend of the main image is incorrect - the thetas do not generate the graphed distributions. one of the following corrections need to be made (but not both): - change theta to beta - change theta value to equal the reciprocal of current theta value — Preceding unsigned comment added by 2602:306:33DA:45D0:E5D9:115F:4571:C00D (talk) 07:47, 20 March 2016 (UTC)

Assessment comment[edit]

The comment(s) below were originally left at Talk:Gamma distribution/Comments, and are posted here for posterity. Following several discussions in past years, these subpages are now deprecated. The comments may be irrelevant or outdated; if so, please feel free to remove this section.

"Gamma variate" appears to direct to this page. In what way does the gamma function relate to the gamma variate function y(t)=A*t^a*exp(-t/b)? (See Madsen (1992), Phys Med Biol (37) 1597-1600.)

Last edited at 10:00, 23 February 2009 (UTC). Substituted at 19:58, 1 May 2016 (UTC)

Domain of PDF[edit]

On the article it's written

But f is not defined at for . Wouldn't this

be a better definition? (talk) 09:52, 18 June 2016 (UTC)