meanEqualityTests: Multiple test for mean equality

Description Usage Arguments Details Value Author(s) Examples

Description

Run different tests of mean equality (parametric or not) on each row of a data table, and return a table summarizing the results returned by each test.

The function also runs test to check the conditions of applicability for the mean equality tests: (1) Test of normality: Shapiro; (2) Tests of variance equality: F-test (parametric), Levene (non-parametric), Brown-Forsythe (non-parametric, robust estimators).

Usage

1
2
meanEqualityTests(x, g, goi = NULL, selected.tests = NULL, alpha = 0.05,
  verbosity = 0)

Arguments

x

A matrix or data frame

g

A vector describing group assigment (length should equal the number of columns of the input matrix)

goi

Group of interest. Required for the two-groups tests (Student, Welch, Wilcoxon)

alpha

Significance threshold (will be applied on corrected p-values)

verbosity

level of verbosity (print messages during execition)

selected.tests=NA

Selection of a subset of tests to run.

Details

First version: 2015-03 Last modification: 2015-03

Value

param

Parameters of the analysis

selected.tests

Tests ran. If no test was specified, all possible tests are selected.

nb.per.group

A sorted vector indicating the number of individuals (columns) per group.

stats.per.row

data.frame summarizing some descriptive statistics + the significance scores (p-value, e-value, fdr) returned by the different tests for each row of the input matrix.

Author(s)

Jacques van Helden (Jacques.van-Helden@univ-amu.fr)

Examples

 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
40
41
42
43
44
## Load example data set from Den Boer, 2009
library(denboer2009)
data(denboer2009.expr)     ## Load expression table
data(denboer2009.pheno)    ## Load phenotypic data
data(denboer2009.amp)    ## Load absent/marginal/present calls to filter input set

## Select subtypes represented by at least 30 samples
verbose("Selecting subtypes with at least 30 samples")
samples.per.subtype <- table(denboer2009.pheno$sample.labels)
selected.subtypes <- names(samples.per.subtype)[samples.per.subtype >= 30]
selected.samples <- denboer2009.pheno$sample.labels %in% selected.subtypes

## Define group labels and group of interest
g <- denboer2009.pheno[selected.samples, "sample.labels"]
goi <- "Bh" ## Select one cancer subtype as group of interest

## Filter out genes called absent in most samples
verbose("Selecting probeset present in at least 30 samples")
selected.probesets <- apply(denboer2009.amp == "P", 1, sum) >= 30
x <- denboer2009.expr[selected.probesets, selected.samples]
verbose(paste("Matrix size:", nrow(x), "x", ncol(x)))

## Run several mean equality tests on each row of the data set.
## We restrict it to the first probesets for the demo.
diff.results <- meanEqualityTests(x=x, g=g, goi=goi, 
    selected.tests=c("welch", "wilcoxon"), verbosity=1)

## Return the parameters of the analysis
print(diff.results$param)
print(diff.results$selected.tests)
print(diff.results$nb.per.group)

## Compare p-values returned by 2 tests
welch.vs.wilcoxon <- meanEqualityTests.compareTwoTests(
   diff.results, test1="welch", test2="wilcoxon")

## Display the names of the result field stat.per.row
names(diff.results$stats.per.row)

## Draw a color Volcano plot for Welch test results
meanEqualityTests.plotVolcano(diff.results, test="welch", legend.cex=0.7, plot.cex=0.5)

## Draw a grayscale Volcano plot for Welch test results
meanEqualityTests.plotVolcano(diff.results, test="welch", legend.cex=0.7, plot.cex=0.5, plot.colors=FALSE)

jvanheld/stats4bioinfo documentation built on May 20, 2019, 5:16 a.m.