I am using my own code to compute a residual of a resistance line (an EDA approach to regression). I write the following code as a general function for the residual
Thank you Luke, the last 2 paragraphs of your response exactly address the issue raised. The main mistake I made is mistakenly passing d[,2] instead of d[i,2]. I no longer see the warning after making this correction.