plotContrasts: Plot representation of contrast matrix

Description Usage Arguments Value Examples

View source: R/plotContrasts.R

Description

Plot contrast matrix to clarify interpretation of hypothesis tests with linear contrasts

Usage

1

Arguments

L

contrast matrix

Value

ggplot2 object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# load library
# library(variancePartition)

# load simulated data:
# geneExpr: matrix of gene expression values
# info: information/metadata about each sample
data(varPartData)

# get contrast matrix testing if the coefficient for Batch2 is zero 
form <- ~ Batch + (1|Individual) + (1|Tissue) 
L1 = getContrast( geneExpr, form, info, "Batch3")

# get contrast matrix testing if the coefficient for Batch2 is different from Batch3 
form <- ~ Batch + (1|Individual) + (1|Tissue) 
L2 = getContrast( geneExpr, form, info, c("Batch2", "Batch3"))

# combine contrasts into single matrix
L_combined = cbind(L1, L2)

# plot contrasts
plotContrasts( L_combined )

variancePartition documentation built on Nov. 8, 2020, 5:18 p.m.