Learn R Programming

wrMisc (version 1.2.3)

test2factLimma: 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.

Usage

test2factLimma(
  datMatr,
  fac1,
  fac2,
  testSynerg = TRUE,
  testOrientation = "=",
  addResults = c("lfdr", "FDR", "Mval", "means"),
  addGenes = NULL,
  silent = FALSE,
  callFrom = NULL
)

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 included to model

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 message(s) produced

Value

object of class "MArrayLM" (from limma)

See Also

makeMAList, single line testing lmFit and the eBayes-family of functions in package limma

Examples

Run this code
# NOT RUN {
## example for testing change of ratio for 4 sets (AA-DD) of pairs of data  
set.seed(2017); t8 <- matrix(round(rnorm(160,10,0.4),2),ncol=8,
  dimnames=list(letters[1:20],c("AA1","BB1","CC1","DD1","AA2","BB2","CC2","DD2")))
t8[3:6,1:2] <- t8[3:6,1:2]+3   # augment lines 3:6 (c-f) for AA1&BB1
t8[5:8,5:6] <- t8[5:8,5:6]+3   # augment lines 5:8 (e-h) for AA2&BB2 (c,d,g,h should be found)
## via MAobj
maOb8 <- makeMAList(t8,MAf=gl(2,4,labels=c("R","G")))
fit8b <- test2factLimma(maOb8,c(1,1,1,1),c(0,0,1,1),testS=FALSE)  # same result as below (fit8e)
limma::topTable(fit8b,coef=1,n=5)                      # effect for c,d,g&h
## explicit (long) way via limma:
fit8 <- limma::lmFit(maOb8, design= model.matrix(~ 0+factor(c(1,1,2,2))))
fit8e <- limma::eBayes(fit8)
limma::topTable(fit8e,coef=1,n=5)                      # effect for c,d,g&h
# }

Run the code above in your browser using DataLab