PHP Class MathPHP\Probability\Distribution\Discrete\Bernoulli

Inheritance: extends Discrete
Exibir arquivo Open project: markrogoyski/math-php

Public Methods

Method Description
CDF ( integer $k, float $p ) : float Bernoulli distribution - cumulative distribution function
PMF ( integer $k, float $p ) : float Bernoulli distribution - probability mass function

Method Details

CDF() public static method

https://en.wikipedia.org/wiki/Bernoulli_distribution 0 for k < 0 1 - p for 0 ≤ k < 1 1 for k ≥ 1
public static CDF ( integer $k, float $p ) : float
$k integer number of successes k ∈ {0, 1}
$p float success probability 0 < p < 1
return float

PMF() public static method

https://en.wikipedia.org/wiki/Bernoulli_distribution q = (1 - p) for k = 0 q = p for k = 1
public static PMF ( integer $k, float $p ) : float
$k integer number of successes k ∈ {0, 1} (int type hint with checkLimit enforces this)
$p float success probability 0 < p < 1
return float