An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111016/f9be5279/attachment.pl>
grouped lattice plot with overall regression line
3 messages · 조혜선, Weidong Gu, Bert Gunter
If you want to draw the global regression line in each panel, you can try
xyplot(T~A|speaker,data=spk0,layout=c(4,5),type='p',groups=fns),
panel=function(x,y,...){
panel.xyplot(x,y,...)
panel.abline(lm(y~x,data=spk0))})
Weidong Gu
2011/10/16 ??? <feb211 at naver.com>:
I'd like to draw a lattice plot with groups. The groups (the grouping condition, fns) are successfully marked with separate symbols, using the following code:
xyplot(T~A|speaker,groups=fns,pch=1:3,key=list(space="right",points=list(pch=1:3)),type=c("g","p","r"))
Here's a hard part. This draws regression lines for each group in each panel (there are three groups, so three regression lines show up in each panel). But I want to have only one global regression line for all groups together, still maintaining separate symbols for each group.
I don't want to have individual regression lines for each group.
I tried many things, with various panel functions, but I've never succeeded. Could any expert help with this? I'd appreciate it greatly. The closest I could find was something like the following, which didn't work for me - anyways, it is supposed to draw by-group regression lines as well as the global one. So this is not exactly I need.
xyplot(T~A|speaker,data=spk0,layout=c(4,5),type='p',groups=fns),
panel=function(x,y){
?panel.superpose(x,y)
?panel.abline(lm(y~x))}),
panel.groups=function(x,y,lty){
?panel.xyplot(x,y,lty=lty)
?panel.abline(lm(y~x),lty=3)})
Thanks so much !!!
? ? ? ?[[alternative HTML version deleted]]
______________________________________________ R-help at 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.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111016/c8e2d38e/attachment.pl>