private function compute(Dataset $data): array
    {
        $dimension = $data->dimension()->rows();
        $elements = $dimension->value();
        $x = $data->abscissas()->toArray();
        $y = $data->ordinates()->toArray();

        $xSum = $data->abscissas()->sum();
        $ySum = $data->ordinates()->sum();
        $xxSum = new Integer(0);
        $xySum = new Integer(0);

        for ($i = 0; $i < $elements; $i++) {
            $xySum = add($xySum, multiply($x[$i], $y[$i]));
            $xxSum = add($xxSum, multiply($x[$i], $x[$i]));
        }

        $slope = divide(
            subtract(
                $dimension->multiplyBy($xySum),
                $xSum->multiplyBy($ySum)
            ),
            subtract(
                $dimension->multiplyBy($xxSum),
                $xSum->power(new Integer(2))
            )
        );
        $intercept = divide(
            subtract(
                $ySum,
                $slope->multiplyBy($xSum)
            ),
            $dimension
        );

        return [$slope, $intercept];
    }