dataFrame.columns.stat — sumSquaresWithin()

Description

The sumSquaresWithin() method of the stat object computes the within-group sum of squares (SSW) for the selected columns.

Signature

dataFrame.columns(...columnNames).stat.sumSquaresWithin()
Scope
columns
Family
stat
Returns
number

Argument

...columnNames ( string[] )
The name of the columns from which to compute the within-group sum of squares.

Returns

ssw (number)
The computed within-group sum of squares.

Notes

  • The method requires at least two selected columns.
  • The statistic measures the variability within groups.
  • The value is computed from deviations of observations around their respective group means.
  • Larger values indicate greater dispersion within groups.
  • The within-group sum of squares contributes to the computation of ANOVA F-statistics.
  • The statistic is also known as the residual sum of squares in one-way ANOVA.

Example

// calculate the SSW from the values of 2 columns of the dataFrame
var ssw = dataFrame.columns('group_1', 'group_2').stat.sumSquaresWithin();

// log the SSW
notebook.log(ssw);