MathPHP\Statistics\Regression\Methods\LeastSquares::sumOfSquaresResidual PHP Метод

sumOfSquaresResidual() публичный Метод

The sum of the squares of residuals (deviations predicted from actual empirical values of data). It is a measure of the discrepancy between the data and an estimation model. https://en.wikipedia.org/wiki/Residual_sum_of_squares SSres = ∑(yᵢ - f(xᵢ))² = ∑(yᵢ - ŷᵢ)² where yᵢ is an observed value ŷᵢ is a value predicted by the regression model
public sumOfSquaresResidual ( ) : number
Результат number
    public function sumOfSquaresResidual()
    {
        $Ŷ = $this->reg_Yhat;
        return array_sum(array_map(function ($yᵢ, $ŷᵢ) {
            return ($yᵢ - $ŷᵢ) ** 2;
        }, $this->reg_ys, $Ŷ));
    }