Git Product home page Git Product logo

BadMethodCallException: PDF not implemented. Please create a pull request if you implement it yourself. in /Library/WebServer/Documents/playground-raj/vendor/gburtini/distributions/src/gburtini/Distributions/Distribution.php on line 10 about probability-distributions-for-php HOT 5 CLOSED

gburtini avatar gburtini commented on June 24, 2024
BadMethodCallException: PDF not implemented. Please create a pull request if you implement it yourself. in /Library/WebServer/Documents/playground-raj/vendor/gburtini/distributions/src/gburtini/Distributions/Distribution.php on line 10

from probability-distributions-for-php.

Comments (5)

tvogt avatar tvogt commented on June 24, 2024

I'd love to have these functions available. If I understand correctly, it is possible to work around it by using gburtini\Distributions\Accessories\BetaFunction. I'm doing this to get a graph of the distribution curve to display it visually:

    $last = 0; $data = array();
    for ($i=0;$i<=1.0;$i+=0.01) {
        $b = BetaFunction::incompleteBetaFunction($i, $this->alpha, $this->beta);
        $data[] = $b-$last;
        $last = $b;
    }

from probability-distributions-for-php.

gustawdaniel avatar gustawdaniel commented on June 24, 2024

For beta

https://en.wikipedia.org/wiki/Beta_distribution

CDF is definded by integral

https://en.wikipedia.org/wiki/Beta_function#Incomplete_beta_function

Because of different needs we should balance between time and accuracy. I propose the following interface

$beta->cdf($x, ?$params) // optional $params as associative array with info about precision

from probability-distributions-for-php.

gustawdaniel avatar gustawdaniel commented on June 24, 2024

@tvogt it looks good. I will test behavior of your solution tomorrow and type there about potential boundaries. I didn't know that this package has incompleteBetaFunction implemented.

from probability-distributions-for-php.

tvogt avatar tvogt commented on June 24, 2024

Look into Accessories\BetaFunction - there is quite a bit of code there which I mostly don't understand (I mean I understand the code, but not what it means).

from probability-distributions-for-php.

gustawdaniel avatar gustawdaniel commented on June 24, 2024

@tvogt I added the following CDF for Beta Distribution.

    /**
     * @param $x
     * @return float|int
     * Definition: https://en.wikipedia.org/wiki/Beta_function#Incomplete_beta_function
     * we can calculate integral but better idea is to use fraction representation:
     * In our code there is implemented method http://functions.wolfram.com/GammaBetaErf/Beta3/10/
     */
    public function cdf($x)
    {
        return BetaFunction::incompleteBetaFunction($x, $this->alpha, $this->beta);
    }

In link

http://functions.wolfram.com/GammaBetaErf/Beta3/10/

You have a representation of this function that has quite nice convergence. Integrating is more intuitive, but due to numerical reason is not preferred.

from probability-distributions-for-php.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.