Exemplo n.º 1
0
 /**
 	Returns the cumulative distribution function, the probability of getting the test value or something below it
 	
 	@param float $x The test value
 	@param float $k Shape parameter
 	@return float The probability
 */
 static function getCdf($x, $k = 1)
 {
     return \PHPStats\Stats::lowerGamma($k / 2.0, $x / 2) / \PHPStats\Stats::gamma($k / 2.0);
 }
Exemplo n.º 2
0
 /**
 	Returns the cumulative distribution function, the probability of getting the test value or something below it
 	
 	@param float $x The test value
 	@param float $k Shape parameter
 	@param float $theta Scale parameter
 	@return float The probability
 */
 static function getCdf($x, $k = 1, $theta = 1)
 {
     return \PHPStats\Stats::lowerGamma($k, $x / $theta) / \PHPStats\Stats::gamma($k);
 }
Exemplo n.º 3
0
 public function test_gamma()
 {
     $this->assertEquals(1, round(Stats::gamma(1), 3));
     $this->assertEquals(1, round(Stats::gamma(2), 3));
     $this->assertEquals(1.3293326, round(Stats::gamma(2.5), 7));
     $this->assertEquals(2, round(Stats::gamma(3), 5));
     $this->assertEquals(6, round(Stats::gamma(4), 5));
     $this->assertEquals(24, round(Stats::gamma(5), 5));
     $this->assertEquals(120, round(Stats::gamma(6), 4));
 }