[R] vectorizing ANOVA over a vectorized linear model

hadley wickham h.wickham at gmail.com
Sun Mar 7 20:08:11 CET 2010

Hi Mark,

If efficiency is a concern you might want to read "Computing Thousands
of Test Statistics Simultaneously in R" by Holger Schwender and Tina
Müller, http://stat-computing.org/newsletter/issues/scgn-18-1.pdf.

If you just want to do it, see the examples in


On Sun, Mar 7, 2010 at 7:03 PM, Mark Kimpel <mwkimpel at gmail.com> wrote:
> Is it possible to vectorize anova over the output of a vectorized lm?  I
> have a gene expression matrix with each row being a gene and columns for
> samples. There are several factors with interactions. I can get p values by
> looping over the matrix with lm and anova, but I would like to make this as
> computationally efficient as possible. I am able to vectorize the lm
> command, but when I try to use anova on the resultant model object I get
> just one anova result.
> Is what I want to do possible? And, yes, I am quite conversant with Limma
> and other BioC packages, I have my reasons for wanting to use lm and anova.
> Thanks,
> Mark
> Mark W. Kimpel MD  ** Neuroinformatics ** Dept. of Psychiatry
> Indiana University School of Medicine
> 15032 Hunter Court, Westfield, IN  46074
> (317) 490-5129 Work, & Mobile & VoiceMail
> (317) 399-1219 Skype No Voicemail please
>        [[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.

Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University

More information about the R-help mailing list