Learn R Programming

OCplus (version 1.46.0)

tstatistics: Compute multiple parallel t-statistics

Description

tstatistics computes either two-sample or paired t-statistics for a bunch of variables measured on the same objects, e.g. genewise t-statistics for a microarray experiment. PermNull uses tstatistics to generate a permutation distribution.

Usage

tstatistics(xdat, grp, logse = FALSE, paired = FALSE)
PermNull(xdat, grp, nperm = 100, seed = NULL, logse = FALSE, paired=FALSE)

Arguments

xdat
the matrix of expression values, with genes (or variables) as rows and samples as columns.
grp
a grouping variable giving the class membership of each sample, i.e. each column in xdat, see Details.
nperm
number of permutations for establishing the null distribution of the t-statistic
seed
random number generator seed for initializing the permutations from a known starting point.
logse
logical flag indicating whether to return the logarithmized standard errors, too.
paired
indicates whether to use two-sample or paired t-statistic.

Value

A data frame with first column tstat and optionally (if logse=TRUE) a second column logse. tstat returns the same number of test statistics as rows in xdat and in the same order, PermNull does the same for consecutive permuations of the grouping variable grp.If the argument seed is specified, PermNull adds an attribute of the same name to the returned data frame.

Details

tstatistics is a fairly fast replacement for function mt.teststat in package multtest, which is written exlusively in R and does not require loading half the Bioconductor infrastructure packages before doing anything. As such, it is used for computing the default test statistics by fdr1d and fdr2d.

Note that for the paired test, tstatistics requires the same data structure as mt.teststat: columns belonging to the same pair must be consecutive (though not necessarily in the same order throughout, as grp will indicate the order). The function checks for this and barfs if it does not hold.

PermNull returns the t-statistics and optionally the logarithmized standard errors of the mean for a specified number of permutations.

Both functions are not especially economic in using memory, and collecting the whole set of permutations like PermNull does instead of binning and counting them directly as they come is inherently wasteful.

See Also

fdr1d, fdr2d, examples in tMixture