Solved – Fitting gamma distribution – loc parameter relation to alpha and beta

distributionsgamma distributionpython

I am trying to fit some data using python scipy.fit with the gamma distribution.

This returns three parameters (alpha, loc, beta). I would like to use these parameters to generate some data in excel, but the gamma function in excel only take values of alpha and beta.

Could someone explain how the "loc" parameter is related to the gamma distribution and how I can alter alpha and beta to be correct?

Best Answer

Gamma function has three parametrizations:

  • With a shape parameter k and a scale parameter θ.
  • With a shape parameter α = k and an inverse scale parameter β = 1/θ, called a rate parameter.
  • With a shape parameter k and a mean parameter μ = k/β.

In Excel, the second, "standradized", form is used. But it's possible to shift and/or scale the distribution using the loc and scale parameters. Specifically, gamma.pdf(x, alfa, loc, scale) is identically equivalent to gamma.pdf(y, alfa) / scale with y = (x - loc) / scale.

Hence to generate data in Excel just apply loc as above and then use Excel function as usual with parameters, returned from scipy.fit

Related Question