I want to measure the distance between a set of points and a 1:1 line. I can build a linear model and get the residuals from the best fit, but I cant get the measure from a 1:1 line. Any helpful hints?
#build a df of random numbers
x=runif(100, 0, 100)
y=runif (100, 0, 100)
df=cbind (x,y)
df=as.data.frame(df)
#build a linear model
lm1<-lm(y~x, data=df)
summary (lm1)
#plot the data, lm best fit and 1:1 (red) line)
plot (y~x, data=df, pch=16)
line (lm1)
abline abline(0,1, col="red")
#get residulas for the linear model
y.resid= resid (lm1)