public static function centralMoment(array $X, $n)
{
if (empty($X)) {
return null;
}
$μ = Average::mean($X);
$∑⟮xᵢ − μ⟯ⁿ = array_sum(array_map(function ($xᵢ) use($μ, $n) {
return pow($xᵢ - $μ, $n);
}, $X));
$N = count($X);
return $∑⟮xᵢ − μ⟯ⁿ / $N;
}