Skip to main content
Module

x/statistics/src/variance.ts>variance

Deno basic statistics module.
Latest
function variance
import { variance } from "https://deno.land/x/statistics@v0.1.1/src/variance.ts";

The variance is the sum of squared deviations from the mean.

This is an implementation of variance, not sample variance: see the sampleVariance method if you want a sample measure.

Examples

variance([1, 2, 3, 4, 5, 6]); // => 2.9166666666666665

Parameters

x: number[]

a population of one or more data points

Returns

number

variance: a value greater than or equal to zero. zero indicates that all values are identical.