reversed residual calculation