PHP code example of gburtini / distributions

1. Go to this page and download the library: Download gburtini/distributions library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gburtini / distributions example snippets


use gburtini\Distributions\Beta;
$beta = new Beta(1, 100);
$draw = $beta->rand();
if($draw > 0.5) {
  echo "We drew a number bigger than 0.5 from a Beta(1,100).\n";
}

// $beta->pdf($x) = [0,1]
// $beta->cdf($x) = [0,1] non-decreasing
// $beta::quantile($y in [0,1]) = [0,1] (aliased Beta::icdf)
// $beta->rand() = [0,1]

// for BetaICDF there is optional paramerer maxIterations = 100, to change default value type
// $beta->icdf($x, ["maxIterations" => 30])