MathPHP\Statistics\Descriptive::meanAbsoluteDeviation PHP Метод

meanAbsoluteDeviation() публичный статический Метод

The average of the absolute deviations from a central point. It is a summary statistic of statistical dispersion or variability. (https://en.wikipedia.org/wiki/Average_absolute_deviation) ∑|xᵢ - x̄| MAD = --------- N x̄ is the mean N is the number of numbers in the population set
public static meanAbsoluteDeviation ( array $numbers ) : numeric
$numbers array
Результат numeric
    public static function meanAbsoluteDeviation(array $numbers)
    {
        if (empty($numbers)) {
            return null;
        }
        $x = Average::mean($numbers);
        $∑│xᵢ − x│ = array_sum(array_map(function ($xᵢ) use($x) {
            return abs($xᵢ - $x);
        }, $numbers));
        $N = count($numbers);
        return $∑│xᵢ − x│ / $N;
    }