public function cooksD() : array
{
$e = $this->residuals();
$h = $this->leverages();
$mse = $this->meanSquareResidual();
$p = $this->p + $this->fit_constant;
return array_map(function ($eᵢ, $hᵢ) use($mse, $p) {
return $eᵢ ** 2 / $mse / $p * ($hᵢ / (1 - $hᵢ) ** 2);
}, $e, $h);
}