[R] what the problem could be if i am suddenly unable to add abline to the scatter plot?
Daniel Malter
daniel at umd.edu
Wed May 12 19:38:52 CEST 2010
Xin, you plot the scatterplot wrongly.
Note that the lm (your OLS regression) has a wiggle, whereas you plot
command has a comma. The plot command also should have a wiggle so that you
plot y against x and not x against y. See example below:
x=rnorm(100);e=rnorm(100)
y=2*x+e
reg=lm(y~x)
par(mfcol=c(1,2))
#This is wrong)
plot(y,x)
abline(reg)
#This is right
plot(y~x)
abline(reg)
--
View this message in context: http://r.789695.n4.nabble.com/what-the-problem-could-be-if-i-am-suddenly-unable-to-add-abline-to-the-scatter-plot-tp2196304p2196469.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list