Description Usage Arguments Value Author(s) See Also Examples
These functions provide a simple interface to compute (paired) Student t statistics in the analysis of high-dimensional case-control studies.
1 2 | studentt.stat(X, L, var.equal=TRUE, paired=FALSE)
studentt.fun(L, var.equal=TRUE)
|
X |
data matrix. Note that the columns correspond to variables (“genes”) and the rows to samples. |
L |
factor with class labels for the two groups. If only a single label is given then a one-sample t score against 0 is computed. |
var.equal |
assume equal (default) or unequal variances in each group. |
paired |
compute paired t-score (default is to use unpaired t-score). |
d
The studentt.stat function returns a vector containing the t-statistic for each variable. It can be specified whether the variances in the two groups are equal. A paired t-score can also be computed.
The studentt.fun function returns a function that computes the t-score statistics when applied to a data matrix (useful for simulations).
Verena Zuber and Korbinian Strimmer (https://strimmerlab.github.io).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # load st library
library("st")
# load Choe et al. (2005) data
data(choedata)
X <- choe2.mat
dim(X) # 6 11475
L <- choe2.L
L
# L may also contain some real labels
L = c("group 1", "group 1", "group 1", "group 2", "group 2", "group 2")
# student t statistic (equal variances)
score = studentt.stat(X, L)
order(score^2, decreasing=TRUE)[1:10]
# [1] 11068 724 9990 11387 11310 9985 9996 11046 43 50
# the same computed with standard R methods (slower!)
#score2 = apply(X, 2, function(x) t.test(x ~ L, var.equal=TRUE)$statistic)
#sum((score-score2)^2)
# student t statistic (unequal variances)
score = studentt.stat(X, L, var.equal=FALSE)
order(score^2, decreasing=TRUE)[1:10]
# [1] 11068 724 9990 11387 11310 9985 9996 11046 43 50
# the same computed with standard R methods (slower!)
#score2 = apply(X, 2, function(x) t.test(x ~ L, var.equal=FALSE)$statistic)
#sum((score-score2)^2)
# paired student t statistic
score = studentt.stat(X, L, paired=TRUE)
order(score^2, decreasing=TRUE)[1:10]
# [1] 9985 7239 5393 11387 11310 9942 10238 9996 11015 11276
# the same computed with standard R methods (slower!)
#score2 = apply(X, 2, function(x) t.test(x ~ L, paired=TRUE)$statistic)
#sum((score-score2)^2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.