row.ttest.stat {metaMA}R Documentation

Row t-tests

Description

Performs t-tests for unpaired data row by row.

Usage

row.ttest.stat(mat1, mat2)

Arguments

mat1

Matrix with data for the first condition

mat2

Matrix with data for the second condition

Details

This function is much faster than employing apply with FUN=t.test

Value

Vector with t-test statistics

Examples

## 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)}

[Package metaMA version 3.1.3 Index]