0

I want to add the lines between the reggression line and the points in the figure but I don't find a solution.

This is my currently plot

enter image description here

zz_fm <-lm(x ~ y)
plot(y,x, xlim = c(0,100),ylim=c(0,110))
abline(zz_fm, col ="green")

Can someone help me?

Tim Wendt
  • 11
  • 4
  • Relevant post? https://stats.stackexchange.com/questions/53254/how-to-find-residuals-and-plot-them What is the expected output? – zx8754 Oct 09 '17 at 11:43
  • 1
    Try plot(y,x, xlim = c(0,100),ylim=c(0,110)) abline(resid(zz_fm), col ="green") – Aleksandr Oct 09 '17 at 11:46
  • What for? you make regression so you can plot fitted values over residuals. You see residuals on your plot as a distance between the line and the point. – Mateusz1981 Oct 09 '17 at 11:49
  • Linked Q is not an _exact_ duplicate, but the stats.SE link is a duplicate. take your pick – MichaelChirico Oct 09 '17 at 11:56
  • @Aleksandr, your solution doesn't work. I don't know if it's clear what I want. I want to plot the lines between the reggression line and the points – Tim Wendt Oct 09 '17 at 12:17
  • Maybe you want something like this? https://www.r-bloggers.com/visualising-residuals/ – MrFlick Oct 09 '17 at 15:00

0 Answers0