Re: [R] Row-wise two sample T-test on subsets of a matrix

2007-03-12 Thread Tim Hesterberg
This is the kind of thing that rowMeans was made for. For the numerator of the t statistic: x1 - temp.matrix[,1:11] x2 - temp.matrix[,12:22] numerator - rowMeans(x1) - rowMeans(x2) For the denominator, if you're using S+ you can use rowVars; in R you can program a simple version quickly, e.g.

[R] Row-wise two sample T-test on subsets of a matrix

2007-03-01 Thread Nameeta Lobo
Hello all, I am trying to run a two sample t-test on a matrix which is a 196002*22 matrix. I want to run the t-test, row-wise, with the first 11 columns being a part of the first group and columns 12-22 being a part of the second group. I tried running something like (temp.matrix being my

Re: [R] Row-wise two sample T-test on subsets of a matrix

2007-03-01 Thread Ranjan Maitra
Here's one suggestion: convert the matrix into a three-dimensional array and use apply on it. Ranjan On Thu, 1 Mar 2007 11:51:29 -0600 (CST) Nameeta Lobo [EMAIL PROTECTED] wrote: Hello all, I am trying to run a two sample t-test on a matrix which is a 196002*22 matrix. I want to run the

Re: [R] Row-wise two sample T-test on subsets of a matrix

2007-03-01 Thread Stefano Calza
I'd suggest to use the function mt.teststat in the package multtest or rowttests in the package genefilter. Both can be found athe the bioconductor webpage (www.bioconductor.org) Stef On Thu, Mar 01, 2007 at 12:48:29PM -0600, Ranjan Maitra wrote: RanjanHere's one suggestion: convert the

Re: [R] Row-wise two sample T-test on subsets of a matrix

2007-03-01 Thread Petr Klasterecky
Ranjan Maitra napsal(a): Here's one suggestion: convert the matrix into a three-dimensional array and use apply on it. Converting to 3 dims should not be neccessary: m - matrix(rnorm(110),ncol=22) t.list - apply(m,1,function(x){t.test(x[1:11],x[12:22],paired=TRUE)}) However, I have no idea