[R] anova for the objects of list
Hai Lin
kevinvol2002 at yahoo.com
Mon Jun 5 20:35:14 CEST 2006
Dear R experts,
Sorry for the previous email. I just figured it out
myself. I would welcome other solutions.
Thanks.
Kevin
my.anova <- sapply(names(my.x),
function(x)
{
anova(my.x[[x]],
my.x1[[x]])
}
)
--- Hai Lin <kevinvol2002 at yahoo.com> wrote:
> Dear R experts,
>
> I have two list objects from runing lme model for
> each
> subjects. And my.x is the full model with all terms
> I
> am interested in and my.x1 is the null model with
> only
> intercept.
>
> I am trying to compare two models at each subject
> level. (Doing anova(my.x[[1]], my.x1[[1]]) is to
> produce stats for the first subject). My goal is to
> obtain stats. for an entire set with hundreds of
> subjects. I did something like this, lapply(my.Tem,
> function(x)anova(x)), but my.Tem actually is not a
> list after combining. It did not work the way as I
> expected.
>
> I am very thankful if anyone here could point me
> out.
>
> Kevin
>
> ####
> 5 subjects extracted as my pilot data.
> > class(my.x)
> [1] "list"
> > length(my.x)
> [1] 5
> > class(my.x1)
> [1] "list"
> > length(my.x1)
> [1] 5
>
> ####
> my.Tem <- cbind(my.x, my.x1)
> > class(my.Tem)
> [1] "matrix"
> > my.Tem
> my.x my.x1
> s1 List,15 List,15
> s2 List,15 List,15
> s3 List,15 List,15
> s4 List,15 List,15
> s5 List,15 List,15
>
>
> __________________________________________________
> Do You Yahoo!?
> protection around
> http://mail.yahoo.com
>
More information about the R-help
mailing list