tablepress
/
libraries
/
vendor
/
PhpSpreadsheet
/
Calculation
/
Statistical
/
StandardDeviations.php
StandardDeviations.php in TablePress – Tables in WordPress made easy 3.4, at libraries/vendor/PhpSpreadsheet/Calculation/Statistical/StandardDeviations.php
| 1 | <?php |
| 2 | |
| 3 | namespace TablePress\PhpOffice\PhpSpreadsheet\Calculation\Statistical; |
| 4 | |
| 5 | class StandardDeviations |
| 6 | { |
| 7 | /** |
| 8 | * STDEV. |
| 9 | * |
| 10 | * Estimates standard deviation based on a sample. The standard deviation is a measure of how |
| 11 | * widely values are dispersed from the average value (the mean). |
| 12 | * |
| 13 | * Excel Function: |
| 14 | * STDEV(value1[,value2[, ...]]) |
| 15 | * |
| 16 | * @param mixed ...$args Data values |
| 17 | * |
| 18 | * @return float|string The result, or a string containing an error |
| 19 | */ |
| 20 | public static function STDEV(...$args) |
| 21 | { |
| 22 | $result = Variances::VAR(...$args); |
| 23 | if (!is_numeric($result)) { |
| 24 | return $result; |
| 25 | } |
| 26 | |
| 27 | return sqrt((float) $result); |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * STDEVA. |
| 32 | * |
| 33 | * Estimates standard deviation based on a sample, including numbers, text, and logical values |
| 34 | * |
| 35 | * Excel Function: |
| 36 | * STDEVA(value1[,value2[, ...]]) |
| 37 | * |
| 38 | * @param mixed ...$args Data values |
| 39 | * @return float|string |
| 40 | */ |
| 41 | public static function STDEVA(...$args) |
| 42 | { |
| 43 | $result = Variances::VARA(...$args); |
| 44 | if (!is_numeric($result)) { |
| 45 | return $result; |
| 46 | } |
| 47 | |
| 48 | return sqrt((float) $result); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * STDEVP. |
| 53 | * |
| 54 | * Calculates standard deviation based on the entire population |
| 55 | * |
| 56 | * Excel Function: |
| 57 | * STDEVP(value1[,value2[, ...]]) |
| 58 | * |
| 59 | * @param mixed ...$args Data values |
| 60 | * @return float|string |
| 61 | */ |
| 62 | public static function STDEVP(...$args) |
| 63 | { |
| 64 | $result = Variances::VARP(...$args); |
| 65 | if (!is_numeric($result)) { |
| 66 | return $result; |
| 67 | } |
| 68 | |
| 69 | return sqrt((float) $result); |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * STDEVPA. |
| 74 | * |
| 75 | * Calculates standard deviation based on the entire population, including numbers, text, and logical values |
| 76 | * |
| 77 | * Excel Function: |
| 78 | * STDEVPA(value1[,value2[, ...]]) |
| 79 | * |
| 80 | * @param mixed ...$args Data values |
| 81 | * @return float|string |
| 82 | */ |
| 83 | public static function STDEVPA(...$args) |
| 84 | { |
| 85 | $result = Variances::VARPA(...$args); |
| 86 | if (!is_numeric($result)) { |
| 87 | return $result; |
| 88 | } |
| 89 | |
| 90 | return sqrt((float) $result); |
| 91 | } |
| 92 | } |
| 93 |