Thanks for your reply.
Yes, abline is much better,but it can only add straight line,and 
lines(fitted(lm(y~x)) ~ x) can do the same thing but not constrain to straight 
line.






At 2013-09-17 20:45:08,"Bretschneider (R)" <brets...@xs4all.nl> wrote:
Dear

 meng,


Re:


Hi all:
I met a question about "lines".


attach(cars)


plot(dist ~ speed)
#add the regression line to the plot
lines(fitted(lm(dist~speed)) ~ speed)


plot(dist ~ speed)
#what kind of curve does the following command add to the plot?
lines(fitted(lm(dist~speed)))

(etc..)








I guess you need the function abline(), not lines() to add a regression line.
Hoping this helps, I remain,
With best wishes,




Franklin
--






Dr. Franklin Bretschneider
Dept of Biology
Utrecht Unversity
Padualaan 8
3584 CH  Utrecht
The Netherlands
f.bretschnei...@uu.nl




        [[alternative HTML version deleted]]

______________________________________________
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