combineVariances
combineVariances(
variance1,mean1,n1,variance2,mean2,n2):number
Defined in: src/combine_variances.js:22
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.
Parameters
Section titled “Parameters”variance1
Section titled “variance1”number
variance of the first list
number
mean of the first list
number
number of items in the first list
variance2
Section titled “variance2”number
variance of the second list
number
mean of the second list
number
number of items in the second list
Returns
Section titled “Returns”number
the combined mean
3.0.0
Example
Section titled “Example”combineVariances(14 / 3, 5, 3, 8 / 3, 4, 3); // => 47 / 12