29 $aMean = self::average(...$args);
37 foreach ($aArgs as $k => $arg) {
38 $arg = self::testAcceptedBoolean($arg, $k);
45 if (self::isAcceptedCountable($arg, $k)) {
46 $returnValue += abs($arg - $aMean);
56 return $returnValue / $aCount;
73 $returnValue = $aCount = 0;
77 $arg = self::testAcceptedBoolean($arg, $k);
84 if (self::isAcceptedCountable($arg, $k)) {
92 return $returnValue / $aCount;
119 if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg !=
'')))) {
122 } elseif (is_string($arg)) {
125 $returnValue += $arg;
132 return $returnValue / $aCount;
156 $aArgs = self::filterArguments($aArgs);
157 $valueCount = count($aArgs);
158 if ($valueCount > 0) {
159 sort($aArgs, SORT_NUMERIC);
160 $valueCount = $valueCount / 2;
161 if ($valueCount == floor($valueCount)) {
162 $returnValue = ($aArgs[$valueCount--] + $aArgs[$valueCount]) / 2;
164 $valueCount = floor($valueCount);
165 $returnValue = $aArgs[$valueCount];
184 public static function mode(...$args)
190 $aArgs = self::filterArguments($aArgs);
192 if (!empty($aArgs)) {
193 return self::modeCalc($aArgs);
205 return (is_numeric($value)) && (!is_string($value));
216 $frequencyArray = [];
221 foreach (
$data as $datum) {
224 foreach ($frequencyArray as
$key => $value) {
225 if ((
string) $value[
'value'] == (
string) $datum) {
226 ++$frequencyArray[
$key][
'frequency'];
227 $freq = $frequencyArray[
$key][
'frequency'];
228 if ($freq > $maxfreq) {
231 $maxfreqdatum = $datum;
232 } elseif ($freq == $maxfreq) {
233 if ($frequencyArray[
$key][
'index'] < $frequencyArray[$maxfreqkey][
'index']) {
235 $maxfreqdatum = $datum;
244 if ($found ===
false) {
245 $frequencyArray[] = [
257 return $maxfreqdatum;
static averageDeviations(... $args)
AVEDEV.
static flattenArray($array)
Convert a multi-dimensional array to a simple 1-dimensional array.
static median(... $args)
MEDIAN.
static mode(... $args)
MODE.
static isMatrixValue($idx)
static flattenArrayIndexed($array)
Convert a multi-dimensional array to a simple 1-dimensional array, but retain an element of indexing...
static averageA(... $args)
AVERAGEA.
static average(... $args)
AVERAGE.
static filterArguments($args)