dataFrame.columns.stat — percentError()

Description

The percentError() method of the stat object computes the percentage error between two selected columns for each row.

Signature

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

Argument

...columnNames ( string[] )
The name of the columns from which to compute the percentage error.

Returns

mask ( number[] )
The percentage error computed for each row.

Notes

  • The method requires exactly two selected columns.
  • The first selected column is interpreted as the reference value.
  • The second selected column is interpreted as the compared value.
  • Percentage error is computed as ((value2 - value1) / value1) × 100.
  • Positive values indicate that the second value is greater than the first value.
  • Negative values indicate that the second value is lower than the first value.
  • A value of 0 indicates that both values are equal.
  • The first column must not contain zero values.

Example

// evaluates the percent error betwwen values of 2 columns of the dataFrame
var mask = dataFrame.columns('actual', 'actual').stat.percentError();

// add the percent errors into the dataFrame
dataFrame.column('percentError').set(mask);