[R] unique sets of factors

Tony Long tdlong at uci.edu
Thu Oct 19 22:10:52 CEST 2006


All:

I have a matrix, X, with a LARGE number of rows.  Consider the 
following three rows of that matrix:

1 1 1 1 2 2 3 3
1 1 1 1 3 3 2 2
3 3 2 2 1 1 1 1

I wish to fit many one-way ANOVAs to some response variable using 
each row as a set of factors.  For example, for each row above I will 
do something like anova(lm(Y~as.factor(X[1,]))).  My problem is that 
in the above example, I do not want to fit models for both rows 1 and 
2 as they are essentially duplicates in terms of the ANOVA model. 
Clearly row 3, although it has the same number of 1's, 2's, and 3's, 
is a different model.

Is there some computationally efficient way to remove such "factor 
duplicates" from my large matrix?  I have been banging my head 
against the wall all morning.

Thanks!!

Tony
-- 
###########################

Tony Long

Ecology and Evolutionary Biology
Steinhaus Hall
University of California at Irvine
Irvine, CA
92697-2525

Tel:  (949) 824-2562   (office)
Tel:  (949) 824-5994   (lab)
Fax: (949) 824-2181

email:  tdlong at uci.edu
http://hjmuller.bio.uci.edu/~labhome/



More information about the R-help mailing list