Xy plot help

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Xy plot help

arun kirshna
Dear R group,

Tried to turn off the html in yahoo.  So far  not successful.  Apologies!

I tried to get xyplot shrink fit for my mixed model.  But, the mixed model line is not seen in the graph.
I would like to know if there is anything wrong with my code.
Thanks,
A.K.



(fm1 <- lmer(Response3 ~1+ Wavelength*Start_Resp*time + (1|resid) + (1+time|Subject_BDat), family=binomial,
data=Behavdat, REML=0))

df <- coef(lmList(Response ~ time | SubjectBDat, Behavdat))
fclow <- subset(df, '(Intercept)' < -4.1)
fchigh <- subset(df, '(Intercept)' > -4.1)
cc1 <- as.data.frame(coef(fm1)$Subject)
names(cc1) <- c("A", "B","C","D","E","F","G","H","I","K","L","M")
df <- cbind(df, cc1)
ff <- fixef(fm1)
SubjectBDat<-as.factor(Behavdat$Subject)
print(xyplot(Response ~ time | SubjectBDat, Behavdat,
              type = c("g", "p", "r"),
             coef.list = df[,3:14],
             panel = function(..., coef.list) {
                 panel.xyplot(...)
                 panel.abline(as.numeric(coef.list[packet.number(),]),
                              col.line = trellis.par.get("superpose.line")$col[2],
                              lty = trellis.par.get("superpose.line")$lty[2]
                              )
                 panel.abline(fixef(fm),
                              col.line = trellis.par.get("superpose.line")$col[4],
                              lty = trellis.par.get("superpose.line")$lty[4]
                              )
             },
             index.cond = function(x,y) coef(lm(y ~ x))[1],
             xlab = "time",
             ylab = "Response",
             key = list(space = "top", columns = 3,
             text = list(c("Within-subject", "Mixed model", "Population")),
             lines = list(col = trellis.par.get("superpose.line")$col[c(1:2,4)],
             lty = trellis.par.get("superpose.line")$lty[c(1:2,4)]))))
        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: [R-sig-ME] Xy plot help

Hugo Mildenberger
On Sun, 29 Apr 2012 11:27:06 -0700 (PDT)

arun <[hidden email]> wrote:

> I tried to get xyplot shrink fit for my mixed model._ But, the mixed model line is not seen in the graph.
> I would like to know if there is anything wrong with my code.

Typo? Try  panel.abline(fixef(fm1),... or panel.abline(ff), ...

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: [R-sig-ME] Xy plot help

Jeff Newmiller
In reply to this post by arun kirshna
A) Yes, there is something wrong. Code not reproducible. Behavdat not found.

B) Last time I used it, Yahoo Mail could send in plain text. Admittedly that has been awhile, but Google sez read [1] and/or [2].

[1] http://help.yahoo.com/tutorials/mail/mail_persmsg1.html
[2] http://email.about.com/od/yahoomailtips/qt/et/plain_text.htm
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<[hidden email]>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.

arun <[hidden email]> wrote:

>Dear R group,
>
>Tried to turn off the html in yahoo.� So far� not successful.�
>Apologies!
>
>I tried to get xyplot shrink fit for my mixed model.� But, the mixed
>model line is not seen in the graph.
>I would like to know if there is anything wrong with my code.
>Thanks,
>A.K.
>
>
>
>(fm1 <- lmer(Response3 ~1+ Wavelength*Start_Resp*time + (1|resid) +
>(1+time|Subject_BDat), family=binomial,
>data=Behavdat, REML=0))
>
>df <- coef(lmList(Response ~ time | SubjectBDat, Behavdat))
>fclow <- subset(df, '(Intercept)' < -4.1)
>fchigh <- subset(df, '(Intercept)' > -4.1)
>cc1 <- as.data.frame(coef(fm1)$Subject)
>names(cc1) <- c("A", "B","C","D","E","F","G","H","I","K","L","M")
>df <- cbind(df, cc1)
>ff <- fixef(fm1)
>SubjectBDat<-as.factor(Behavdat$Subject)
>print(xyplot(Response ~ time | SubjectBDat, Behavdat,
>������������� type = c("g", "p", "r"),
>������������ coef.list = df[,3:14],
>������������ panel = function(..., coef.list) {
>���������������� panel.xyplot(...)
>���������������� panel.abline(as.numeric(coef.list[packet.number(),]),
>����������������������������� col.line =
>trellis.par.get("superpose.line")$col[2],
>����������������������������� lty =
>trellis.par.get("superpose.line")$lty[2]
>����������������������������� )
>���������������� panel.abline(fixef(fm),
>����������������������������� col.line =
>trellis.par.get("superpose.line")$col[4],
>����������������������������� lty =
>trellis.par.get("superpose.line")$lty[4]
>����������������������������� )
>������������ },
>������������ index.cond = function(x,y) coef(lm(y ~ x))[1],
>������������ xlab = "time",
>������������ ylab = "Response",
>������������ key = list(space = "top", columns = 3,
>������������ text = list(c("Within-subject", "Mixed model",
>"Population")),
>������������ lines = list(col =
>trellis.par.get("superpose.line")$col[c(1:2,4)],
>������������ lty = trellis.par.get("superpose.line")$lty[c(1:2,4)]))))
> [[alternative HTML version deleted]]
>
>_______________________________________________
>[hidden email] mailing list
>https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

______________________________________________
[hidden email] 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.