On Thursday 10 February 2005 09:34, Christoph Scherber wrote:
> Dear R Users,
>
> I have an xyplot() where different plotting symbols are used for
> subgroups (originally used within S-Plus, but hopefully itīs also
> applicable to R users).
>  How can I fit separate regression lines for every subgroup? So far,
> I can only plot the overall fitted line.
>
> The code looks like this:
>
> trellis.device()
> sps<-trellis.par.get("superpose.symbol")
> sps$pch<-1:7
> trellis.par.set("superpose.symbol",sps)
>
> spl <- trellis.par.get("superpose.line")
> ps$lty <- 1:7
> trellis.par.set("superpose.line",spl)
> xyplot(a~b|factor+treatment,
> groups=external,data=ownframe,layout=c(2,2),
> panel=function(x,y,subscripts,...){panel.superpose(x,y,subscripts,...
>);panel.lmline(x,y)})

xyplot(a~b|factor+treatment,
       groups=external,data=ownframe,layout=c(2,2),
       panel.groups=function(x,y,...){ 
           panel.xyplot(x,y,...)
           panel.lmline(x,y,...)
       }) 

or

xyplot(a~b|factor+treatment,
       groups=external,data=ownframe,layout=c(2,2),
       type = c('p', 'r'))

Deepayan

______________________________________________
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