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

Generate random numbers with bivariate gamma distribution in R

How to generate random numbers with bivariate gamma distribution. The density is: F(X, Y)(x, y) = αp+qxp-1(y-x)q-1e-αy / [Γ(p) Γ(q)], 𝕀0≤ x≤ y With y>x>0, α>0, p>0 and q>0. I did not find any package on R that does this and nothing in literature.
fsbmat
  • 291
  • 3
  • 12
2
votes
1 answer

How to plot a Gamma distribution in ggplot2

I have a plot in R that I am trying to replicate in ggplot2. I have the following code: theta = seq(0,1,length=500) post <- dgamma(theta,0.5, 1) plot(theta, post, type = "l", xlab = expression(theta), ylab="density", lty=1, lwd=3) I have tried to…
Alex
  • 2,603
  • 4
  • 40
  • 73
2
votes
1 answer

How to draw random numbers from a gamma distribution without the Statistics Toolbox?

I am varying the signal strength for synthetic images. I need the signal to vary between 0 and 0.1, but I need to do this with a gamma distribution so that more of them fall around the .01/.02 range. The problem is that I am using the 2010 version…
Kelsey
  • 21
  • 3
2
votes
1 answer

gamma distribution lower limit in R

I would like to fit a gamma distribution to a dataset made of 338 elements, with a fixed low threshold (I'm using R). To represent the low limit I thought to use a gamma with three parameters, adding the location. Here's my…
F. De Leo
  • 37
  • 1
  • 5
2
votes
1 answer

Graphical output of density for the function gammamixEM (package mixtools)

I'm using the function gammamixEM from the package mixtools. How can I return the graphical output of density as in the function normalmixEM (i.e., the second plot in plot(...,which=2)) ? Update: Here is a reproducible example for the function…
Marine
  • 521
  • 1
  • 4
  • 23
2
votes
1 answer

equivalent of Matlab's gaminv in python

I would like to translate the following Matlab code in Python: tau=40 %scale parameter a=3 %shape parameter t = gaminv(0.90,a,tau); The code returns t = 212.8928. I've tried: import scipy.stats.distributions as dist tau=40 a=3 t =…
user1363251
  • 421
  • 1
  • 11
  • 24
2
votes
0 answers

Negative binomial dispersion parameter in Matlab

The matlab function nbinfit returns the values r and p for the negative binomial. Is there an equivalent MLE function in matlab that instead returns the values for mu (mean) and theta (the dispersion parameter) for the "ecological" or "Polya"…
2
votes
1 answer

Gamma Distribution in Boost

I'm trying to use the Gamma distribution from boost::math but it looks like it isn't possible to use it with boost::variate_generator. Could someone confirm that? Or is there a way to use it. I discovered that there is a boost::gamma_distribution…
Kamchatka
  • 3,597
  • 4
  • 38
  • 69
2
votes
1 answer

how to solve a distribution parameters from its mean and variance

I update the OP so that the original question can be solved by solving the following equations. integral_from_0_N of (x * f(x)) dx = constant // here , constant > 0 , N > 0 where f(x) = g(j,k) * (x/k)^(j-1) * exp(-x/k) // here, k > 0 , j >…
1
vote
2 answers

Finding Percentiles and Values From Calculated Gamma Distribution

Background I am working on computing a series of best-fit gamma curves for a 2-D dataset in Numpy (ndarray), a prior question for the genesis of this can be found here. Scipy was previously utilized (scipy.gamma.stats), however this library is not…
TornadoEric
  • 399
  • 3
  • 16
1
vote
1 answer

Fitting GammaRegressor() and getting the scale and shape parameters

My response variable follows a gamma distribution and I'm trying to use gammaRegressor from scikit-learn: model = GammaRegressor() model.fit(X_train_scaled, y_train) pred_gamma = model.predict(X_test_scaled) What are the shape and the scale…
1
vote
1 answer

Sampling from a mixture of two Gamma distributions

My intention was to generate samples from two mixed and heavily right-skewed Gamma distributions using the package called bmixture. Some examples are provided at…
iGada
  • 599
  • 3
  • 9
1
vote
1 answer

Why is Mean Square error of a gamma variable not being calculated?

So I have written this code that calculates mean square estimates of alpha and beta for different values of samples and betas. The value of alpha is 3, since we add three exponential distributions to create the gamma variable. However, this code…
1
vote
1 answer

Random numbers in C++: one engine, multiple distributions -> unexpected behaviour

I am using C++14. I want to generate a random number stream using a random engine and draw random variates from different distributions from this stream. I find, however, that there appears some interaction between the distributions which leads to…
bp236
  • 11
  • 2
1
vote
1 answer

Ruby version of gamma.fit from scipy.stats

As the title suggests, I am trying to find a function that can take an array of floats and find a distribution that fits my data. From here I'll use it to find the CDF of new data I am passing it. I have installed and looked through the sciruby…
bubbaspaarx
  • 616
  • 4
  • 15