test2factLimma {wrMisc} | R Documentation |
2-Factorial Limma-Style t-Test
Description
The aim of this function is to provide convenient acces to two-factorial (linear) testing withing the framework of makeMAList
including the emprical Bayes shrinkage.
The input data 'datMatr' which should already be organized as limma-type MAList, eg using using makeMAList
.
Note: This function uses the Bioconductor package limma (which must be installed).
Usage
test2factLimma(
datMatr,
fac1,
fac2,
testSynerg = FALSE,
testOrientation = "=",
addResults = c("lfdr", "FDR", "Mval", "means"),
addGenes = NULL,
silent = FALSE,
callFrom = NULL,
debug = FALSE
)
Arguments
datMatr |
matrix or data.frame with lines as indenpendent series of measures (eg different genes) |
fac1 |
(character or factor) vector describing grouping elements of each line of 'datMatr' for first factor, must be of same langth as fac2 |
fac2 |
(character or factor) vector describing grouping elements of each line of 'datMatr' for second factor, must be of same langth as fac1 |
testSynerg |
(logical) decide if factor-interactions (eg synergy) should be tested in model, otherwise additive factors are supposed |
testOrientation |
(character) default (or any non-recignized input) '=', otherwise either '>','gerater','sup','upper' or '<','inf','lower' |
addResults |
(character) vector defining which types of information should be included to output, may be 'lfdr','FDR' (for BY correction), 'Mval' (M values), 'means' (matrix with mean values for each group of replicates) |
addGenes |
(matrix or data.frame) additional information to add to output |
silent |
(logical) suppress messages |
callFrom |
(character) allow easier tracking of messages produced |
debug |
(logical) additional messages for debugging |
Value
This function returns an object of class "MArrayLM" (from limma) containing/enriched by the testing results
See Also
makeMAList
, single line testing lmFit
and the eBayes
-family of functions in package limma
Examples
set.seed(2014)
dat0 <- rnorm(30) + rep(c(10,15,19,20),c(9,8,7,6))
fa <- factor(rep(letters[1:4],c(9,8,7,6)))
dat2 <- data.frame(facA=rep(c("-","A","-","A"), c(9,8,7,6)),
facB= rep(c("-","-","B","B"), c(9,8,7,6)), dat1=dat0, dat2=runif(30))
grpNa <- sub("-","",sub("\\.","", apply(dat2[,1:2], 1, paste, collapse="")))
test2f <- test2factLimma(t(dat2[,3:4]), dat2$facA, dat2$facB)
test2f # just the p-values
# Similarly, you can easily summarize results using topTable from limma
if(requireNamespace("limma", quietly=TRUE)) {
test2g <- test2factLimma(t(dat2[,3:4]), dat2$facA, dat2$facB, addR=FALSE)
library(limma)
topTable(test2g, coef=1, n=5)
topTable(test2g, coef=2, n=5) }