Skip to main content
Module

x/statistics/mod.ts>sumNthPowerDeviations

Deno basic statistics module.
Latest
function sumNthPowerDeviations
Re-export
import { sumNthPowerDeviations } from "https://deno.land/x/statistics@v0.1.1/mod.ts";

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.

Examples

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;

Parameters

x: number[]
n: number

power

Returns

number

sum of nth power deviations