dataFrame.columns.stat — residuals()
Description
The residuals() method of the stat object computes the residuals between two selected columns for each row.
Signature
dataFrame.columns(...columnNames).stat.residuals()Argument
...columnNames( string[] )- The name of the columns from which to compute the residuals.
Returns
mask(array)- An array containing the residual value for each row.
Notes
- The method requires exactly two selected columns.
- The first selected column is interpreted as the observed values.
- The second selected column is interpreted as the predicted values.
- Residuals are computed as
observed - predicted. - Positive values indicate underestimation by the prediction.
- Negative values indicate overestimation by the prediction.
- A value of
0indicates a perfect prediction.
Example
// calculate the residuals between the values of 2 columns of the dataFrame
var mask = dataFrame.columns('actual', 'predicted').stat.residuals();
// add the residuals to the dataFrame
dataFrame.column('residuals').set(mask);