Talk:Gamma distribution
From Wikipedia, the free encyclopedia
[edit] Implementing cdf
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 function...as 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)
[edit] PDF/CDF confusion
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)
[edit] alternative parameterization
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)
[edit] Relation to maxwell-bolzmann
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)
[edit] Real-world examples
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 195.28.231.13 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)
Samuel 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
[edit] Cite? Approximation when some x = 0?
The approximation provided for k is very useful in general, but what is one to do when xi = 0, 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
[edit] Theta or 1/theta ?
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 http://mathworld.wolfram.com/GammaDistribution.html 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 (k,θ), 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)
[edit] Graphs of pdf misleading
The graph presented on the main page for k=1, theta = 2 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)
[edit] Confusion about parameter names
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
24.235.165.89 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)
[edit] infinitely divisible
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)
[edit] exponential family
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? 134.60.66.52 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. --134.60.66.52 12:30, 18 April 2007 (UTC)
- No worries... :) MisterSheik 12:41, 18 April 2007 (UTC)
[edit] Image
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)
[edit] Gamma or Γ?
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)
[edit] Proof of some of the basic stuff
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
- X˜Γ(k1,θ) and Y˜Γ(k2,θ)
- 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
- X + Y˜Γ(k1 + k2,θ)
- 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)
[edit] sir i need some information about statistical distributions
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 "a_smile4me@yahoo.com".i will wait ur response. —Preceding unsigned comment added by 58.65.201.212 (talk) 18:48, 20 October 2007 (UTC)
[edit] Generating variables
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)





