sumNthPowerDeviations
sumNthPowerDeviations(
x,n):number
Defined in: src/sum_nth_power_deviations.js:18
The sum of deviations to the Nth power. When n=2 it’s the sum of squared deviations. When n=3 it’s the sum of cubed deviations.
Parameters
Section titled “Parameters”number[]
number
power
Returns
Section titled “Returns”number
sum of nth power deviations
Example
Section titled “Example”var input = [1, 2, 3];// since the variance of a set is the mean squared// deviations, we can calculate that with sumNthPowerDeviations:sumNthPowerDeviations(input, 2) / input.length;