Andreas Svensson wrote:

> So, how can I constrain the abline to the relevant region, i.e stop
> abline from extrapolating beyond the actual range of data.
> Or should I use a function line 'lines' to do this?

One elegant way of doing this is using 'xyplot' from 'lattice' and adding a
loess line with a large value of 'span' (which basically makes is equal to
the ordinary least-squares regression line). Here's a simple example:

library(lattice)
data(iris)
xyplot(Petal.Length~Petal.Width,
       groups=Species, type=c("p","smooth"), span=100, data=iris)

-- 
Karl Ove Hufthammer

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to