Skip to main content
Module

x/simplestatistics/index.js>combineVariances

simple statistics for node & browser javascript
Go to Latest
function combineVariances
import { combineVariances } from "https://deno.land/x/simplestatistics@v7.7.5/index.js";

When combining two lists of values for which one already knows the variances, one does not have to necessary recompute the variance of the combined lists in linear time. They can instead use this function to compute the combined variance by providing the variance, mean & number of values of the first list and the variance, mean & number of values of the second list.

Examples

combineVariances(14 / 3, 5, 3, 8 / 3, 4, 3); // => 47 / 12

Parameters

variance1

variance of the first list

mean1

mean of the first list

n1

number of items in the first list

variance2

variance of the second list

mean2

mean of the second list

n2

number of items in the second list