[R] anova for the objects of list

Hai Lin kevinvol2002 at yahoo.com
Mon Jun 5 18:03:34 CEST 2006


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



More information about the R-help mailing list