Calculating the mean absolute error and the residual sum of squares