When d!=0, the first few residuals must be zero

to be consistent with R's result