[R] several regression lines in panel of xyplot (trellis graphics)
bates at stat.wisc.edu
Tue May 13 16:39:33 CEST 2003
Wladimir Eremeev <wl at eimb.ru> writes:
> Dear r-help,
> I need to draw xyplot() graphs with several regression lines:
> one line for the whole range of x (the variable on the horizontal
> axis) and two additional lines for subranges of x.
> Is it possible to make first regression line (panel.lmline(x,y,...);)
> to be drawn on the whole graph
> and regression lines of the subsets to be drawn only over their subsets?
> I have defined
> then I draw plots:
> This command draws graphics, but all regression lines on them are
> drawn from the left side to the right side, i.e. over the whole x
I think you will need to do the linear model fits to the data subsets
within the panel function then use panel.segments to add the lines.
More information about the R-help