Skip to main content
Module

x/simplestatistics/index.js>combineMeans

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

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

Examples

combineMeans(5, 3, 4, 3); // => 4.5

Parameters

mean1

mean of the first list

n1

number of items in the first list

mean2

mean of the second list

n2

number of items in the second list