row.ttest.stat | R Documentation |
Performs t-tests for unpaired data row by row.
row.ttest.stat(mat1, mat2)
mat1 |
Matrix with data for the first condition |
mat2 |
Matrix with data for the second condition |
This function is much faster than employing apply with FUN=t.test
Vector with t-test statistics
## The function is currently defined as function(mat1,mat2){ n1<-dim(mat1)[2] n2<-dim(mat2)[2] n<-n1+n2 m1<-rowMeans(mat1,na.rm=TRUE) m2<-rowMeans(mat2,na.rm=TRUE) v1<-rowVars(mat1,na.rm=TRUE) v2<-rowVars(mat2,na.rm=TRUE) vpool<-(n1-1)/(n-2)*v1 + (n2-1)/(n-2)*v2 tstat<-sqrt(n1*n2/n)*(m2-m1)/sqrt(vpool) return(tstat)}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.