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
0
votes
1 answer

How to bound centile curves for a censored distribution

I'm trying to fit centile curves for a censored gamma distribution. The censoring goes well I think, but when trying to make the percentile curves, I get the following result: I tried the following code to get this: y <- c(35.00, 100.00, 100.00, …
0
votes
0 answers

Gamma Fit for R0 in SIR Model Sometimes Shows a Spike in the Graph

we're doing the SIR model. Sometimes when we run the simulation a hundred times we get a weird gamma distribution for the R0s that looks like this.We ran this for 10 simulations and the R0 values were: [5.69740264 5.02800221 5.31973113 7.6658689…
0
votes
0 answers

Fitting gamma mixture distribution in R

I got two gamma distributions, which could be a good fit to my data, but to be sure I need to do Kolmogorov-Smirnov test as well as chi-square goodness of fit. (If you have any suggestion which other way is suitable to confirm that mixture…
Saida
  • 3
  • 2
0
votes
0 answers

FitDataError: Invalid values in `data`. Maximum likelihood estimation with 'gamma' requires that 0 < (x - loc)/scale < inf for each x in `data`

I was trying with the below code, and I met with the specified error code. Can anyone tell me why is it coming like this? Code: import numpy as np import xarray as xr from scipy.stats import gamma import matplotlib.pyplot as plt data1 =…
0
votes
1 answer

Plot gamma distribution scipy.stats python

I'm trying to plot a gamma distribution and I expect it to be normalized, but somehow, the values always diverge too much and I'm not getting the expected result. My code so far looks like this: from scipy.stats import gamma a,loc,scale =…
backer
  • 3
  • 2
0
votes
1 answer

Properly Fitting a Gamma Cumulative Distribution Function

I have two Numpy arrays (both 210 entries in total) of rainfall values, one observed and the other forecast. My goal is to create a best-fit gamma CDF (my first time diving into gamma CDFs) to both of these arrays and determine the relevant…
TornadoEric
  • 399
  • 3
  • 16
0
votes
1 answer

Negative binomial , Poisson-gamma mixture winbugs

Winbugs trap error model { for (i in 1:5323) { Y[i] ~ dpois(mu[i]) # NB model as a Poisson-gamma mixture mu[i] ~ dgamma(b[i], a[i]) # NB model as a poisson-gamma mixture a[i] <- b[i] / Emu[i] b[i] <- B * X[i] Emu[i] <- beta0 * pow(X[i], beta1)…
0
votes
0 answers

Is there a cost in precision to using runif + qgamma instead of rgamma, in order to force a predictable number of PRNG calls?

I have an R project in which it is desirable (both for debugging and for analysis) if I can set a random seed, make a series of calls to random distribution functions, and have the state of the PRNG at any point in that series depend only on the…
0
votes
1 answer

Installing Ruby GSL on Heroku

We are using a the distribution gem for calculating a gamma distribution and because we specifically require the gamma quantile method, we also require gsl https://github.com/sciruby/distribution https://github.com/SciRuby/rb-gsl This works fine…
bubbaspaarx
  • 616
  • 4
  • 15
0
votes
0 answers

How to fit autocorrelation structures in a diving glmer model vs nlme and glmmTMB models?

I want to compare diving behaviour between penguin populations breeding at different locations using generalized linear mixed effects models (glmer). The data looks like this: # A tibble: 12 × 7 # Groups: ID [1] ID begdesc …
0
votes
0 answers

how to check Goodness of fit for Gamma Distribution, Weibull Distribution, Exponential Distribution with Anderson Darling Test

how to check Goodness of fit for Gamma Distribution, Weibull Distribution, Exponential Distribution with Anderson Darling Test? Thankyou
Daisha
  • 1
0
votes
0 answers

ggplot2::geom_smooth fails with method=gamlss::gamlss, with warning about different number of rows: 80, 81

I have decades of daily rainfall data, which are mostly zeroes (dry days). The Zero-Adjusted Gamma Distribution (ZAGA) fits the data relatively well. I'd like to plot the relationship between rainfall and a continuous variable, using…
climatestudent
  • 459
  • 4
  • 13
0
votes
1 answer

glm with gamma family with NA / 0 Values in r

I would like to use a generalized linear mixed effect model. My data follows a gamma distribution but contains NA and 0 values. However, the gamma family does not allow me to compute these models if I have 0 values. Does anyone know of a way to go…
0
votes
0 answers

C++ boost library to generate negative binomial random variables

I'm new to C++ and I'm using the boost library to generate random variables. I want to generate random variables from a negative binomial distribution. The first parameter of boost::random::negative_binomial_distribution freq_nb(r, p); has to…
dan
  • 25
  • 6
0
votes
1 answer

scipy distributions provide zero for values smaller than loc (mean)

For the data yielding the below histogram, I used gamma.fit(data) function. It yields (0.2856629839547822, 0.001612367540316285, 1.3126526078419007) which must be the alpha, loc, and scale parameters of the distribution. However, the mean and…