in

.NET Opensource

Community for opensource projects by Christoph Rüegg

Gamma distribtuion

Last post 09-10-2009 16:42 by chhenning. 18 replies.
Page 1 of 2 (19 items) 1 2 Next >
Sort Posts: Previous Next
  • 03-12-2009 19:03

    Gamma distribtuion

    Hi there, I'm new here and would like to know if the Gamma Distribution is part of this math lib? I need to calculate the pdf or cdf values based on the shape and scale parameters. Is there maybe another lib or package I can use to do that? Thanks, Christian
  • 03-12-2009 19:19 In reply to

    Re: Gamma distribtuion

    Yes, the gamma distribution is supported and provides both pdf and cdf (plus invcdf as a bonus)

    Iridium Feature List

  • 03-12-2009 20:02 In reply to

    Re: Gamma distribtuion

    Cool, this is exactly what I'm looking for! How about the quantile? Meaning the x value for 99.9%, for instance. Regards, Christian
  • 03-13-2009 15:48 In reply to

    Re: Gamma distribtuion

    Well, you could use the invcdf for that.

    Unfortunately if I remember right the gamma invcvd method was added after the latest release (iteration 16), so you'd either have to wait for the next (intermediate) release or build it yourself directly from the source code repository.

  • 03-13-2009 15:59 In reply to

    Re: Gamma distribtuion

    Fair enough. Where can I access the source code?
  • 03-13-2009 16:10 In reply to

    Re: Gamma distribtuion

    I found the subversion mirror on google code. Let's see if I can build it it. Never done that before.
  • 03-13-2009 16:15 In reply to

    Re: Gamma distribtuion

    http://mathnet.opensourcedotnet.info/Repository.aspx

    Of course I can also provide a newer intermediate build, so let me know if it doesn't work for you..

  • 03-13-2009 17:18 In reply to

    Re: Gamma distribtuion

    I works now. Thanks for this great lib. Christian
  • 03-13-2009 20:53 In reply to

    Re: Gamma distribtuion

    Hi there, I did some testing and there are might be some problems with the gamma distribution calculation. Especially with the InverseCumulativeDistribution. There are many exceptions in the case alpha is very small and beta is very high. For instance double alpha = 0.016512683231958761; double beta = 73076944.560563684; GammaDistribution gamma_dist = new GammaDistribution(alpha, beta); double left_tail = gamma_dist.InverseCumulativeDistribution(0.001); // will fail Running on C or C++ works fine. Here lefttail would be 8.7180841109937266e-175. Is that a C# problem or more a problem of the used methodology ( the way the quantile is calculated )? Thanks, Christian
  • 04-01-2009 14:09 In reply to

    Re: Gamma distribtuion

    Thanks for reporting. It's actually a convergence issue, and thus a problem in the (numerical) approximation algorithm/approach. I'm working on that.
  • 04-08-2009 12:05 In reply to

    Re: Gamma distribtuion

    FYI, the convergence issue is now tracked as IRID-204.
  • 05-18-2009 16:06 In reply to

    Re: Gamma distribtuion

    FYI, IRID-204 has been fixed in the repository (commit c153b93b8f2d583d8cc92fcb8084b4cc2bf04bf7), which will be included in the next release.
  • 06-04-2009 18:19 In reply to

    Re: Gamma distribtuion

     The only function I need is Gamma regularized, and I got exactly that problem, so my question is:

    ¿is safe to use Intermediate Build 17.479 for Gamma regularized function?

  • 06-04-2009 18:35 In reply to

    Re: Gamma distribtuion

    The only line of my code that uses MathNet.Iridium is

    Return MathNet.Numerics.Fn.GammaRegularized(Alfa, Value)

    when I call it with Alfa = 124.07408201977513

    and value = 124.69139128721039

     I get this exception:

    "Value is too large for the current iteration limit.
    Parameter name: a "

     

    I tried both Math.NET Iridium 2008 August Release, v2008.8.16.470

    and 

     Intermediate Build 17.479

     but got the same error.

     

    I just need to replace Excel Gamma dristribution function. I does not instantiate a gamma class, just call the function with parameters I calculate.

     

    Is there a workaround?

     

  • 06-04-2009 18:51 In reply to

    Re: Gamma distribtuion

    Until the next release, as a workaround you could use the internal build I attached to this post. However, I strongly recommend to upgrade to the official build in the next release once available (I'm actually almost ready, so it's a matter of days).
Page 1 of 2 (19 items) 1 2 Next >
Powered by Community Server (Non-Commercial Edition), by Telligent Systems