dataFrame.columns.stat — geometricMeanWeighted()

Description

The geometricMeanWeighted() method of the stat object computes using two selected columns: a value column and a weight column.

Signature

dataFrame.columns(...columnNames).stat.geometricMeanWeighted()
Scope
columns
Family
stat
Returns
mask

Argument

...columnNames ( string[] )
The name of the columns from which to compute the weighted geometric means.

Returns

mask (array)
The computed weighted geometric means.

Notes

  • The method requires exactly two selected columns.
  • The first selected column is interpreted as the values.
  • The second selected column is interpreted as the weights.
  • All values must be strictly positive.
  • Larger weights increase the influence of the corresponding values.
  • The weighted geometric mean is computed using the supplied weights.

Example

// calculate the geometric means of the values of 1 column of the dataFrame with the weights of a 2nd column of the dataFrame
var mask = dataFrame.columns('age', 'income').stat.geometricMeanWeighted();

// add the geometric means into the dataFrame
dataFrame.column('geometricMeanWeighted').set(mask);