Update standard-deviation.md
This commit is contained in:
@ -7,7 +7,7 @@ NOTE: This is **population standard deviation**. Use `/ (arr.length - 1)` at the
|
|||||||
calculate **sample standard deviation**.
|
calculate **sample standard deviation**.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const standardDeviation = (arr, val) =>
|
const standardDeviation = arr =>
|
||||||
Math.sqrt(
|
Math.sqrt(
|
||||||
arr.reduce((acc, val) => acc.concat(Math.pow(val - arr.reduce((acc, val) => acc + val, 0) / arr.length, 2)), [])
|
arr.reduce((acc, val) => acc.concat(Math.pow(val - arr.reduce((acc, val) => acc + val, 0) / arr.length, 2)), [])
|
||||||
.reduce((acc, val) => acc + val, 0)
|
.reduce((acc, val) => acc + val, 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user