* Calculate the arithmetic mean of a vector. * * @param {Array} vector The vector represented as an Array of Numbers. * * @returns {number} The arithmetic mean.
(vector)
| 87 | * @returns {number} The arithmetic mean. |
| 88 | */ |
| 89 | function mean(vector) { |
| 90 | let sum = 0; |
| 91 | for (const x of vector) { |
| 92 | sum += x; |
| 93 | } |
| 94 | return sum / vector.length; |
| 95 | }; |
| 96 | |
| 97 | /** |
| 98 | * Calculate the standard deviation of a vector. |
no outgoing calls
no test coverage detected