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
1
vote
0 answers

Edit: Set dispersion parameter in pooled dataset (mids object)

EDIT 2 27/7: I figured out that I must get the correct output if I set the dispersion parameter to 0.64. I tried doing this with summary(fit, dispersion = 0.64) but this doesn't work. Probably because it is an imputed dataset with pooled…
Charlotte
  • 19
  • 5
1
vote
0 answers

Method of Moments for Gamma distribution- histogram and superimposing the PDF

I have this question. 'Model the data in nfsold (nfsold is just a vector containing 150 numbers)as a set of 150independent observations from a Gamma(lambda; k) distribution. Use the Method of Moments, to obtain estimates of k and lambda. Draw a…
Han
  • 15
  • 4
1
vote
2 answers

Python covert x axis unit of gamma distribution

I have a gamma distribution with shape and scale parameter 2.126, 0.370. You can plot it with following code: shape, scale = 2.126, 0.370 # mean=4, std=2*sqrt(2) s = np.random.gamma(shape, scale, 1000) weights =…
GDI
  • 647
  • 1
  • 7
  • 17
1
vote
1 answer

Fitting a Gamma Distribution to Streamflows with R

Hello I have a monthly average of stream flow for the last 100 years: Sep <- c(50504.61, 31903.57, 20575.81, 51250, 20282.16, 19932.05, 22302.73, 24777.73, 27681.94, 18676.9, 28587.23, 29030.58, 24433.3, 18785.24, 21913.74, 33662.53, 23215.58,…
1
vote
1 answer

About Gamma density simulation

I am simulating some gamma random numbers plot(density(rgamma(10000,8.1,rate=0.00510)),lwd=2,las=1,cex.axis=0.75, main=expression(paste("Gamma Distribution with",' scale ',alpha," and rate…
user3483060
  • 337
  • 2
  • 13
1
vote
1 answer

Is the density function of the invgamma package wrong?

It seems like invgamma::dinvgamma gives a value that is both different from Wikipedia's and other package. > shape = 1 > scale = 2 > x = 2 > invgamma::dinvgamma(x, shape = shape, scale = scale) [1] 0.0973501 > scale ** shape / gamma(shape) * x **…
Heisenberg
  • 8,386
  • 12
  • 53
  • 102
1
vote
0 answers

Inverse gamma distribution in R

How to implement inverse gamma distribution function in R? I tried with the package Laplaces Demons, but it gives me the error: "Warning message: package ‘LaplacesDemon’ was built under R version 3.3.3 ". Thanks.
yuliavdk
  • 11
  • 2
1
vote
0 answers

Gamma distribution cutting off and not showing up

I made 5 gamma plots and the last one, Gamma(100,7) is cut off. Using the same code, I also made 5 more gamma plots (Gamma(128,8), Gamma(150,9), Gamma(169,10), Gamma(184,11), Gamma(205, 12)) and none of them show up. How do I fix this? Jupyter…
14wml
  • 4,048
  • 11
  • 49
  • 97
1
vote
2 answers

Fit the gamma distribution only to a subset of the samples

I have the histogram of my input data (in black) given in the following graph: I'm trying to fit the Gamma distribution but not on the whole data but just to the first curve of the histogram (the first mode). The green plot in the previous graph…
Hakim
  • 3,225
  • 5
  • 37
  • 75
1
vote
0 answers

Gamma distribution: error

We got this error because we have some zero's in our dataset. Does it have any effect if we will change them to NA or adding one to all the values that we have. Or has it an effect on our analyis? fit1 = glm(actspan~treatment+colony, family =…
Boris
  • 35
  • 1
  • 4
1
vote
1 answer

Add fitted (gamma) distribution density curve to histogram plot from library(MASS) fitdistr

I would like to plot the gamma density function derived from a set of observations over the histogram of the observed data. I am able to generate the histogram and parameter estimates for the gamma fit. This is being done for multiple subsets of…
viridius
  • 477
  • 5
  • 17
1
vote
2 answers

Testing a vector for gamma distribution

I have a problem with a certain vector. I'm tying to find out IF it's gamma-distributed and (if so) what the parameters (shape, rate) are. MY vector has 400 entries but lets take e.g. x <-…
Flo Chi
  • 65
  • 2
  • 9
1
vote
1 answer

I can't plot the kernel density estimation of an Inverse gamma(0.001, 0.001) in matlab

I am trying to plot the ksdensity of an Inverse gamma(0.001, 0.001) but the plot has only one point. The commands I used are alpha1 = 0.001; beta1 = 0.001; n = 1e+5; r=1./gamrnd(alpha1,1/beta1,n,1); [f,xi] = ksdensity(r); …
F.F.
  • 89
  • 7
1
vote
1 answer

How to find the second derivative in R and while using newton's method with numerical derivation

The log-likelihood of the gamma distribution with scale parameter 1 can be written as: (α−1)s−nlogΓ(α) where alpha is the shape parameter and s=∑logXi is the sufficient statistic. Randomly draw a sample of n = 30 with a shape parameter of alpha =…
user114634
  • 11
  • 4
1
vote
1 answer

Php Gamma Distribution Inverse different from Excel

To calculate the Gamma Inverse. I am using the phpExcel library : https://github.com/PHPOffice/PHPExcel/blob/develop/Classes/PHPExcel/Calculation/Statistical.php I use this library and compare it to the result from Excel. For both in Php and Excel…
Mark Spier
  • 11
  • 1