fix statistics function during documentation update

This commit is contained in:
Dennis Eichhorn 2022-09-09 21:00:30 +02:00
parent 7c8469c114
commit 2612e1f862
5 changed files with 24 additions and 2 deletions

View File

@ -172,6 +172,8 @@ final class Average
*
* Example: ([1, 2, 2, 3, 4, 4, 2])
*
* @latex \mu = mean = \frac{1}{n}\sum_{i=1}^{n}a_i
*
* @param array<int, int|float> $values Values
* @param int $offset Offset for outlier
*

View File

@ -39,6 +39,8 @@ final class Correlation
*
* Example: ([4, 5, 9, 1, 3], [4, 5, 9, 1, 3])
*
* @latex \rho_{XY} = \frac{cov(X, Y)}{\sigma_X \sigma_Y}
*
* @param array<int|float> $x Values
* @param array<int|float> $y Values
*
@ -56,6 +58,8 @@ final class Correlation
*
* Example: ([4, 5, 9, 1, 3], [4, 5, 9, 1, 3])
*
* @latex \rho_{XY} = \frac{cov(X, Y)}{\sigma_X \sigma_Y}
*
* @param array<int|float> $x Values
* @param array<int|float> $y Values
*

View File

@ -212,7 +212,7 @@ final class MeasureOfDispersion
*
* Example: ([4, 5, 9, 1, 3], [4, 5, 9, 1, 3])
*
* @latex \sigma_{XY} = cov(X, Y) = \sum_{i = 1}^{N}\frac{\left(x_{i} - \bar{X}\right) \left(y_{i} - \bar{Y}\right)}{N - 1}
* @latex cov(X,Y) = \frac{1}{N} \sum_{i = 1}^{N}\left(x_{i} - \bar{X}\right)\left(y_{i} - \bar{Y}\right)
*
* @param array<int, int|float> $x Values
* @param array<int, int|float> $y Values
@ -255,7 +255,7 @@ final class MeasureOfDispersion
*
* Example: ([4, 5, 9, 1, 3], [4, 5, 9, 1, 3])
*
* @latex \sigma_{XY} = cov(X, Y) = \sum_{i = 1}^{N}\frac{\left(x_{i} - \bar{X}\right) \left(y_{i} - \bar{Y}\right)}{N - 1}
* @latex cov(X,Y) = \frac{1}{N - 1} \sum_{i = 1}^{N}\left(x_{i} - \bar{X}\right)\left(y_{i} - \bar{Y}\right)
*
* @param array<int, int|float> $x Values
* @param array<int, int|float> $y Values

View File

@ -77,6 +77,8 @@ final class ChiSquaredDistribution
/**
* Test hypthesis.
*
* Goodness of fit test.
*
* @param array $dataset Values
* @param array $expected Expected values based on probability
* @param float $significance Significance

View File

@ -75,6 +75,20 @@ final class ArrayUtils
return $data;
}
/**
* Calculate the range of the array
*
* @param int[]|float[] $values Numeric values
*
* @return int|float Range of the array
*
* @since 1.0.0
*/
public static function range(array $values) : int|float
{
return \max($values) - \min($values);
}
/**
* Set element in array by path
*