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

do a nonlinear least square fit in r

I have two vectors: y <- c(0.044924, 0.00564, 0.003848, 0.002385, 0.001448, 0.001138, 0.001025, 0.000983, 0.00079, 0.000765, 0.000721, 0.00061, 0.000606, 0.000699, 0.000883, 0.001069, 0.001226, 0.001433, 0.00162, 0.001685, 0.001604, 0.001674,…
4
votes
1 answer

Finite mixture of tweedie

I'm trying to estimate a finite mixture of tweedie (or compound Poisson-gamma) distributions. I have scoured any resources I can think of, without finding any resources on how to do this. I am currently trying to use the flexmix package in R writing…
masher
  • 41
  • 2
4
votes
2 answers

How can I estimate the shape and scale of a gamma dist. with a particular mean and a 95% quantile?

Is there any way, in R, to calculate the scale and shape of a gamma distribution, given a particular value of mean (or median) and a particular quantile (the 95% quantile)? So for example I have a mean = 130 and a 95% quantile = 300 with an offset…
user18441
  • 643
  • 1
  • 7
  • 15
3
votes
1 answer

R - Error with assignments and mapply function - same error : "number of items to replace is not a multiple of replacement length"

I try to compute the variance of ratio between 2 sum of Gamma distribution with shape and scale different. Numerator : Denominator : To compute this variance, I am using coga library of R. Here's below the code snippet…
user1773603
3
votes
2 answers

How to sample array from gamma distribution with shape values given by different array in Julia?

In Julia, I have an array of shape values and I would like to sample an array who's values are gamma distributed according to the corresponding shape element of my shape array. What I want is: shapes = [1.1, 0.5, 10] scale = 1 x =…
Shep Bryan
  • 567
  • 5
  • 13
3
votes
2 answers

How to fit a Keras model to a Gamma Distribution?

I am trying to fit a keras model in which my output variable is always positive. I want to use a gamma distribution to model this problem. The problem is that the loss always ouptputs NAN. I built the following keras model: model_max =…
3
votes
2 answers

How can I pass multiple parameters to a DistributionLambda layer from Tensorflow probability?

I am building a model using Keras and Tensorflow probability that should output the parameters of a Gamma function (alpha and beta) instead of a single parameter as shown in the example below (t is passed to a Normal distribution function). import…
Alberto
  • 467
  • 3
  • 16
3
votes
0 answers

Difficulty Running Bayesian Gamma Regression with PyMC3

PyMC3 has excellent functionality for dealing with Bayesian regressions, so I've been trying to leverage that to run a Bayesian Gamma Regression using PyMC3 where the likelihood would be Gamma. From what I understand, running any sort of Bayesian…
quant_fin
  • 75
  • 5
3
votes
1 answer

MATLAB | calculating parameters of gamma dist based on mean and probability interval

I have a system of 2 equations in 2 unknowns that I want to solve using MATLAB but don't know exactly how to program. I've been given some information about a gamma distribution (mean of 1.86, 90% interval between 1.61 and 2.11) and ultimately want…
jefflovejapan
  • 2,047
  • 3
  • 20
  • 34
3
votes
1 answer

How to draw fitted graph and actual graph of gamma distribution in one plot?

Step.1. Load the package needed. library(ggplot2) library(MASS) Step.2. Generate 10,000 numbers fitted to gamma distribution. x <- round(rgamma(100000,shape = 2,rate = 0.2),1) x <- x[which(x>0)] Step.3. Draw the pdf(probability density function),…
Ling Zhang
  • 281
  • 1
  • 3
  • 13
3
votes
2 answers

How can we find percentile or quantile of gamma distribution in MATLAB?

Suppose that we have this gamma distribution in MATLAB: I want this part of distribution with higher density (x-axis range). How can I extract this in MATLAB? I fit this distribution using histfit function. PS. My…
Eghbal
  • 3,892
  • 13
  • 51
  • 112
3
votes
2 answers

how to use qgamma in R

The gamma distribution with a shape parameter k and a scale parameter theta is defined by = In R If I want to find the quantile at 0.05 probability for a gamma distribution with Gamma(10,0.5) I used > qgamma(0.05,shape=10,scale=0.5) [1] 2.712703…
sam_rox
  • 739
  • 3
  • 14
  • 29
3
votes
4 answers

Probability of selecting an element from a set

The expected probability of randomly selecting an element from a set of n elements is P=1.0/n . Suppose I check P using an unbiased method sufficiently many times. What is the distribution type of P? It is clear that P is not normally distributed,…
Boris Gorelik
  • 29,945
  • 39
  • 128
  • 170
3
votes
1 answer

Fit gamma mixture to fertility schedule in R

I am trying to fit a gamma mixture model (two gamma distributions) to an age-fertility profile. I have a dataset containing age specific fertility rates and age, and I want to fit two gammas in order to find the corresponding parameters (in the end…
Ale
  • 303
  • 1
  • 9
3
votes
1 answer

What is the equivalent R function to GAMMA.INV(probability,alpha,beta) Excel function?

I need to find the inverse of the gamma cumulative distribution. I know there is GAMMA.INV(probability,alpha,beta) function just to do that in excel. How can I achieve this in R language?
ipman
  • 1,212
  • 2
  • 21
  • 29
1
2
3
14 15