calcTStatFast {sigPathway} | R Documentation |
Computes t-statistics and corresponding p-values.
calcTStatFast(tab, phenotype, ngroups = 2)
tab |
a numeric matrix of expression values, with the rows and columns representing probe sets and sample arrays, respectively |
phenotype |
a numeric vector indicating the phenotype |
ngroups |
an integer indicating the number of groups in the expression matrix |
If there are two groups in the matrix, then the phenotype vector should only consist of 0 and 1 to denote which sample columns belong to which group.
If ngroups
= 2, the t-test done here is equivalent to a unpaired
two-sample t-test, assuming unequal variances.
If there is only one group in the matrix (e.g., Alzheimer's data set as reanalyzed in Tian et al. (2005)), then the phenotype vector should consist of continuous values. In this case, the association between phenotype and expression values is first calculated as Pearson correlation coefficients, transformed to Fisher's z, and then rescaled so that its variance is 1:
z = 0.5*log((1+rho)/(1-rho))*sqrt(n-3), where n is the number of phenotypes.
pval |
A vector of unadjusted p-values |
tstat |
A vector of t-statistics (ngroups = 2) or rescaled
Fisher's z (ngroups = 1) |
rho |
(Also returned when ngroups = 1) A vector of Pearson
correlation coefficients |
Weil Lai
## Load inflammatory myopathy data set data(MuscleData) ## Create appropriate variables for tab <- MuscleData[, c(index.IBM, index.NORM)] phenotype <- c(rep(0,length(index.IBM)), rep(1,length(index.NORM))) statList <- calcTStatFast(tab, phenotype, ngroups = 2) ## Generate histogram of p-values hist(statList$pval, xlab = "Unadjusted p-values", ylab = "Frequency")