On May 12, 2010, at 1:30 PM, Erik Iverson wrote:



David Winsemius wrote:
On May 12, 2010, at 11:57 AM, xin wei wrote:

I am doing very regular stuff like the following:


attach(wtana)

fm<- lm(Body.Wt.on.SD1~Heart.Wt, data=wtana)
#fm<- lm(wtana$Body.Wt.on.SD1~wtana$Heart.Wt)
lrf<- loess(Body.Wt.on.SD1~Heart.Wt, wtana)
#lrf<- loess(wtana$Body.Wt.on.SD1~wtana$Heart.Wt)

plot(Body.Wt.on.SD1,Heart.Wt)
#plot(wtana$Body.Wt.on.SD1,wtana$Heart.Wt)
#lines(spline(Heart.Wt,fitted(lrf)), col=2)
abline(fm, col=4)

however, the abline just refuse to to show up in the scatter cloud.
Does anyone has clue?
I don't know that abline has a method for lm objects.
> methods(abline)
no methods were found
Warning message:
In methods(abline) : function 'abline' appears not to be generic

I haven't read this thread, so don't know what the issue is. abline does not have a method for 'lm' objects, but it does allow you to pass an object with a coef method (e.g., an lm object) to the "reg" parameter.

Perhaps all the OP has to do is specify

abline(reg = fm, col = 4)

Yes. Gets you to the same result:

> x <- 1:10
> y= 5+ x + rnorm(10)
> plot(x, y)
> abline(coef(lm(y ~ x) ) , col="red")


?

David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to