diff --git a/src/Stat.php b/src/Stat.php index c4d816d..193f300 100644 --- a/src/Stat.php +++ b/src/Stat.php @@ -346,6 +346,8 @@ public static function harmonicMean(array $data, ?array $weights = null, ?int $r * Covariance is a measure of the joint variability of two inputs. * @param array $x * @param array $y + * @throws InvalidDataInputException if 2 arrays have different size, + * or if the length of arrays are < 2, or if the 2 input arrays has not numeric elements * @return false|float */ public static function covariance(array $x, array $y): false|float @@ -396,6 +398,9 @@ public static function covariance(array $x, array $y): false|float * and 0 no linear relationship. * @param array $x * @param array $y + * @throws InvalidDataInputException if 2 arrays have different size, + * or if the length of arrays are < 2, or if the 2 input arrays has not numeric elements, + * or if the elements of the array are constants * @return false|float */ public static function correlation(array $x, array $y): false|float diff --git a/tests/StatTest.php b/tests/StatTest.php index 58ab431..44857a8 100644 --- a/tests/StatTest.php +++ b/tests/StatTest.php @@ -319,5 +319,5 @@ [2, 2, 2] ) )->toThrow(InvalidDataInputException::class); - + });