/** * Probability density function * * /v\ / μ²\ * | - | |-1*--- | / ν 3 μ²x² \ / ν + 1 1 μ²x² \ \ * \2/ \ 2 / / ₁F₁| - ; - ; --------- | ₁F₁| ----- ; - ; --------- | | * ν * Γ(ν + 1) * e | \ 2 2 2(ν + x²)/ \ 2 2 2(ν + x²)/ | * --------------------------------- * | √2*μ*x * --------------------------- + -------------------------------- | * ν (ν / 2) | / ν + 1 \ / ν \ | * 2 * (ν + x²) * Γ(ν / 2) | (ν + x²) * Γ| ------ | √(ν + x²) * Γ| - + 1 | | * \ \ 2 / \ 2 / / * * @param number $x percentile * @param int $ν degrees of freedom > 0 * * @return number */ public static function PDF($x, int $ν, $μ) { Support::checkLimits(self::LIMITS, ['x' => $x, 'ν' => $ν, 'μ' => $μ]); $part1 = $ν ** ($ν / 2) * Special::gamma($ν + 1) * exp(-1 * $μ ** 2 / 2) / 2 ** $ν / ($ν + $x ** 2) ** ($ν / 2) / Special::gamma($ν / 2); $F1 = $ν / 2 + 1; $F2 = 3 / 2; $F3 = $μ ** 2 * $x ** 2 / 2 / ($ν + $x ** 2); $inner_part1 = sqrt(2) * $μ * $x * Special::confluentHypergeometric($F1, $F2, $F3) / ($ν + $x ** 2) / Special::gamma(($ν + 1) / 2); $F1 = ($ν + 1) / 2; $F2 = 1 / 2; $inner_part2 = Special::confluentHypergeometric($F1, $F2, $F3) / sqrt($ν + $x ** 2) / Special::gamma($ν / 2 + 1); return $part1 * ($inner_part1 + $inner_part2); }