rStats.js v1.3.0
    Preparing search index...

    Function weightedMean

    • Weighted mean sum(x w) / sum(w). Equivalent to R's weighted.mean(). Values with weight 0 do not enter the numerator (even if infinite or NaN), and naRm drops missing values of x with their weights.

      Parameters

      Returns number

      weightedMean([1, 2, 3], [3, 1, 1]); // 1.6