rpf.1dim.residual function

Calculate residuals