[R] How to extract x rows to get x pvalues using t.test

Marcus Davy MDavy at hortresearch.co.nz
Wed Mar 16 21:53:15 CET 2005


Hi,
if a striped down version of t.test is required for speed, before implementing a rewrite I would check out the multtest Bioconductor package.

It takes a fraction of a second to do 56000 t-tests on a 2.4 Ghz PIV.

 dim(X)
[1] 56000     4

pcols <- 4
replicates <- rep(0:1, each=2)

unix.time({tscores <- mt.teststat(X, classlabel=replicates, test="t.equalvar") 
        dfs <- pcols - 2
        pvalues <- 2*(1-pt(abs(tscores), df=dfs))})
[1] 0.21 0.05 0.26 0.00 0.00

> length(pvalues)
[1] 56000

Check out ?mt.teststat and its test argument options.


Marcus

>>> "Jagarlamudi, Choudary" <choudary.jagar at swosu.edu> 17/03/2005 7:16:13 a.m. >>>
Thanks to everyone who posted on this topic. I tried apply() as Ramasamy had suggested and it took 40 seconds on my machine. The for loop however took over 4 minutes and i gave up. I am going to strip the t.test function and write it as suggested by Andy. Hope that will be the quickest.
 
Once again thank you for all who have posted on this.
 
Choudary Jagarlamudi
Instructor Computer Science
Southwestern Oklahoma State University
STF 254
100 campus Drive
Weatherford OK 73096
Tel 580-774-7136

	[[alternative HTML version deleted]]

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help 
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

______________________________________________________

The contents of this e-mail are privileged and/or confidenti...{{dropped}}




More information about the R-help mailing list