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

standard_deviation.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import variance from "./variance";
/** * The [standard deviation](http://en.wikipedia.org/wiki/Standard_deviation) * is the square root of the variance. This is also known as the population * standard deviation. It's useful for measuring the amount * of variation or dispersion in a set of values. * * Standard deviation is only appropriate for full-population knowledge: for * samples of a population, {@link sampleStandardDeviation} is * more appropriate. * * @param {Array<number>} x input * @returns {number} standard deviation * @example * variance([2, 4, 4, 4, 5, 5, 7, 9]); // => 4 * standardDeviation([2, 4, 4, 4, 5, 5, 7, 9]); // => 2 */function standardDeviation(x) { if (x.length === 1) { return 0; } const v = variance(x); return Math.sqrt(v);}
export default standardDeviation;
simplestatistic

Version Info

Tagged at
2 years ago