deno.land / x / simplestatistic@v7.7.1 / src / coefficient_of_variation.js

coefficient_of_variation.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import mean from "./mean";import sampleStandardDeviation from "./sample_standard_deviation";
/** * The`coefficient of variation`_ is the ratio of the standard deviation to the mean. * .._`coefficient of variation`: https://en.wikipedia.org/wiki/Coefficient_of_variation * * * @param {Array} x input * @returns {number} coefficient of variation * @example * coefficientOfVariation([1, 2, 3, 4]).toFixed(3); // => 0.516 * coefficientOfVariation([1, 2, 3, 4, 5]).toFixed(3); // => 0.527 * coefficientOfVariation([-1, 0, 1, 2, 3, 4]).toFixed(3); // => 1.247 */function coefficientOfVariation(x) { return sampleStandardDeviation(x) / mean(x);}
export default coefficientOfVariation;
simplestatistic

Version Info

Tagged at
2 years ago