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)" <bretschr@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.bretschneider@uu.nl




	[[alternative HTML version deleted]]

