Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters in Gamma distribution #22

Open
mossadal opened this issue Jul 1, 2017 · 5 comments
Open

Parameters in Gamma distribution #22

mossadal opened this issue Jul 1, 2017 · 5 comments

Comments

@mossadal
Copy link
Contributor

mossadal commented Jul 1, 2017

The code for the Gamma distribution is very incomplete -- the class only basically only contains code for random number generation from a Gamma distribution.

I implemented the pdf, cdf, icdf as well as unit tests, and noticed that the parameters are named $shape and $rate, which would seem congruent with alpha and beta as described in Wikipedia's description of the Gamma distribution.

Running the unit tests on Gamma::draw gives a sample of points that seem to be Gamma(alpha, 1/beta) distributed, suggesting that $rate is really $scale.

What is your preference? Changing the parameters to $shape and $scale or keeping $shape and $rate and correct Gamma::draw?

@mossadal
Copy link
Contributor Author

@gburtini Any thoughts on this? I'd like to finish the Gamma implementation (and chi^2 as a special case) with a pull request.

@gburtini
Copy link
Owner

gburtini commented Jul 20, 2017

Hey @mossadal,

Sorry, I hadn't seen the issue. Please feel free to make this decision yourself. In general, I tried to remain congruent with Wikipedia's "first" expository parametrization, but this is totally arbitrary and it does not surprise me that I made an error in this particular case. :)

@mossadal
Copy link
Contributor Author

Thanks, I'll get to this within the next few days.

@gustawdaniel
Copy link
Contributor

gustawdaniel commented Jan 23, 2019

In my opinion, selecting one convention is rather important and I would like to select convention presented in Mathematica from Wolfram Research. Reasons:

  • they have a great tool to calculations for free - wolframalpha.com
  • they have a consistent base of knowledge maintained by a commercial company
  • on Wikipedia, you can find different conventions, MathoWorld has one version

I would like to change the interface of Gamma but worry about backward compatibility. Any versioning is there? I added version 1.0 to my last commit, we can break compatibility if a community will want it.

This issue is similar to #32

@gburtini
Copy link
Owner

gburtini commented Jan 24, 2019

Yep, I agree - let's go with the Mathematica standard.

Feel free to institute semver in your next PR if we haven't already done that. I have it on my long term "like to do" list to come back to this repo. and really improve its engineering decisions.

Thanks for chmining in @gustawdaniel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants