Questions tagged [gamma-distribution]

Anything related to the gamma probability distribution, i.e. a continuous probability distribution whose probability density function is connected to the "gamma function". DO NOT USE this tag for questions about the gamma function, use the [gamma-function] tag instead.

Anything related to the gamma probability distribution, i.e. a continuous probability distribution whose probability density function is connected to the gamma function.

If a variable X follows a gamma distribution with shape parameter k>0 and scale parameter θ, then it has probability density function:

enter image description here

It follows that E(X)=kθ and Var(X)=kθ². In some texts, the gamma distribution is parameterized instead by the rate parameter, which is the reciprocal of the scale parameter: β=1/θ.

DO NOT USE this tag for questions about the gamma function, use the tag instead.

See Wikipedia page on the gamma distribution.


Tag Usage

Questions on should be about implementation and programming problems, not about the statistical or theoretical properties of the technique. Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics, machine learning and data analysis.

219 questions
37
votes
5 answers

Fitting a gamma distribution with (python) Scipy

Can anyone help me out in fitting a gamma distribution in python? Well, I've got some data : X and Y coordinates, and I want to find the gamma parameters that fit this distribution... In the Scipy doc, it turns out that a fit method actually exists…
Archanimus
  • 371
  • 1
  • 3
  • 3
21
votes
3 answers

How to plot gamma distribution with alpha and beta parameters in python

I want to plot a gamma distribution with alpha = 29 (the scale) and beta = 3 (the size). In other words, I want to plot the pdf for Gamma(29,3). How do I do this if according to the documentation, the python gamma function only has parameters a and…
14wml
  • 4,048
  • 11
  • 49
  • 97
15
votes
3 answers

Color spaces, gamma and image enhancement

Color space. Well, everybody knows about RGB: three values normalized in the range [0.0,1.0], which have the meaning of the intensity of the color components Red Green Blue; this intensity is meant as linear, isn't? Gamma. As far I can understand,…
Luca
  • 11,646
  • 11
  • 70
  • 125
14
votes
2 answers

Sampling from an inverse gamma distribution in R

In order to sample from an inverse gamma distribution in R, is the following the correct way to do it: #I want to sample an inverse-gamma(a,b) a = 4 b = 9 x = 1/rgamma(1,a,b)
user2005253
10
votes
2 answers

Errors while trying to fit gamma distribution with R fitdistr{MASS}

I have a problem with fitdistr{MASS} function in R. I have this vector: a <- c(26,73,84,115,123,132,159,207,240,241,254,268,272,282,300,302,329,346,359,367,375,378,…
kuba
  • 1,005
  • 2
  • 11
  • 16
9
votes
3 answers

How would you fit a gamma distribution to a data in R?

Suppose I have the variable x that was generated using the following approach: x <- rgamma(100,2,11) + rnorm(100,0,.01) #gamma distr + some gaussian noise head(x,20) [1] 0.35135058 0.12784251 0.23770365 0.13095612 0.18796901 0.18251968 [7]…
user1172468
  • 5,306
  • 6
  • 35
  • 62
6
votes
1 answer

Is there a difference between gamma hurdle (two-part) models and zero-inflated gamma models?

I have semicontinuous data (many exact zeros and continuous positive outcomes) that I am trying to model. I have largely learned about modeling data with substantial zero mass from Zuur and Ieno's Beginner's Guide to Zero-Inflated Models in R, which…
Kellan Baker
  • 375
  • 3
  • 11
6
votes
2 answers

Gamma GLM: NaN production and divergence errors

Intro I'm trying to construct a GLM that models the quantity (mass) of eggs the specimens of a fish population lays depending on its size and age. Thus, the variables are: eggW: the total mass of layed eggs, a continuous and positive …
A. E.
  • 61
  • 5
6
votes
1 answer

Standard errors discrepancies between SAS and R for GLM gamma distribution

I am comparing GLM output from R and SAS of a model with a Gamma distribution. The point estimations are identical, but they have different estimation of the standard error and therefore different p-values. Does anyone know why? I am wondering if R…
YDao
  • 325
  • 2
  • 15
5
votes
3 answers

Gamma distributed random variables in C++

What is the easiest way to get a gamma distributed random variable in C++? Boost seems to have this functionality, but it is not clear for me how to use it.
Grzenio
  • 35,875
  • 47
  • 158
  • 240
5
votes
1 answer

Empirical Bayes in R

David Robinson gave a great example of empirical Bayes updating with the beta distribution. He found the prior from the distribution and used that prior to update estimates for each batter. This had the remarkable effect of weighting averages…
Alex
  • 2,603
  • 4
  • 40
  • 73
5
votes
2 answers

Using python scipy to fit gamma distribution to data

I want to fit a gamma distribution to my data, which I do using this import scipy.stats as ss import scipy as sp import numpy as np import os import matplotlib.pyplot as plt alpha = [] beta = [] loc = [] data = np.loadtxt(data) fit_alpha, fit_loc,…
Sahil M
  • 1,790
  • 1
  • 16
  • 31
5
votes
1 answer

Mixture of Gaussian and Gamma distribution

I'm looking for some script/package in R (Python will do too) to find out the component distribution parameters from a mixture of Gaussian and Gamma distributions. I've so far used the R package "mixtools" to model the data as mixture of Gaussians,…
The August
  • 469
  • 2
  • 7
  • 18
4
votes
1 answer

What is the parameter a in scipy.stats.gamma library

I am trying to fit Gamma CDF using scipy.stats.gamma but I do not know what exactly is the a parameter and how the location and scale parameters are calculated. Different literatures give different ways to calculate them and its very frustrating. I…
4
votes
1 answer

Gamma distribution in python

We have qgamma in R and gamm.inv in excel, and I am not able to get the same results using invgamma function in python. For example in excel GAMMA.INV(0.99,35,0.08)=4.01, I can get the same value from R using qgamma with probability=0.99,…
SKD
  • 51
  • 3
1
2 3
14 15