Learn R Programming

wrMisc (version 1.2.3)

moderTestXgrp: Multiple moderated pair-wise t-tests from limma

Description

Runs all pair-wise combinations of moderated t-tests from package 'limma' on each line of data against 1st group from 'grp'. Note: This function requires the package limma from bioconductor. The limma contrast-matrix has to be read by column, the lines in the contrast-matrix containing '+1' will be compared to the '-1' lines, eg grpA-grpB .

Usage

moderTestXgrp(
  dat,
  grp,
  limmaOutput = TRUE,
  addResults = c("lfdr", "FDR", "Mval", "means"),
  testOrientation = "=",
  silent = FALSE,
  callFrom = NULL
)

Arguments

dat

matrix or data.frame with rows for multiple (independent) tests, use ONLY with 2 groups; assumed as log2-data !!!

grp

(factor) describes column-relationship of 'dat' (1st factor is considered as reference -> orientation of M-values !!)

limmaOutput

(logical) return full (or extended) MArrayLM-object from limma or 'FAlSE' for only the (uncorrected) p.values

addResults

(character) types of results to add besides basic limma-output (eg "lfdr" using fdrtools-package,"FDR" for BY-FDR,"Mval" (assumes that data are log2 !),"means" or "nonMod" for non-moderated test)

testOrientation

(character) for one-sided test (">","greater" or "<","less"), NOTE : 2nd grp is considered control/reference, '<' will identify grp1 < grp2

silent

(logical) suppress messages

callFrom

(character) allow easier tracking of message(s) produced

Value

limma-type MA-object (list)

See Also

moderTest2grp for single comparisons, lmFit and the eBayes-family of functions in package limma

Examples

Run this code
# NOT RUN {
grp <- factor(rep(LETTERS[c(3,1,4)],c(2,3,3)))
set.seed(2017); t8 <- matrix(round(rnorm(208*8,10,0.4),2),ncol=8,
  dimnames=list(paste(letters[],rep(1:8,each=26),sep=""),paste(grp,c(1:2,1:3,1:3),sep="")))
t8[3:6,1:2] <- t8[3:6,1:2] +3                    # augment lines 3:6 (c-f) 
t8[5:8,c(1:2,6:8)] <- t8[5:8,c(1:2,6:8)] -1.5    # lower lines 
t8[6:7,3:5] <- t8[6:7,3:5] +2.2                  # augment lines 
## expect to find C/A in c,d,g, (h)
## expect to find C/D in c,d,e,f
## expect to find A/D in f,g,(h)  
test8 <- moderTestXgrp(t8,grp) 
head(test8$p.value,n=8)
# }

Run the code above in your browser using DataLab