pairwiseFC: Compute pairwise fold changes

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This function computes pairwise fold changes. It also works for logarithmic data.

Usage

1
pairwise.fc(x, g, ave = mean, log = TRUE, base = 2, mod.fc = TRUE, ...)

Arguments

x

numeric vector.

g

grouping vector or factor

ave

function to compute the group averages.

log

logical. Is the data logarithmic?

base

If log = TRUE, the base which was used to compute the logarithms.

mod.fc

logical. Return modified fold changes? (see details)

...

optional arguments to ave.

Details

The function computes pairwise fold changes between groups, where the group values are aggregated using the function which is given by the argument ave.

The fold changes are returned in a slightly modified form if mod.fc = TRUE. Fold changes FC which are smaller than 1 are reported as to -1/FC.

The implementation is in certain aspects analogously to pairwise.t.test.

Value

Vector with pairwise fold changes.

Author(s)

Matthias Kohl Matthias.Kohl@stamats.de

See Also

pairwise.t.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
set.seed(13)
x <- rnorm(100) ## assumed as log2-data
g <- factor(sample(1:4, 100, replace = TRUE))
levels(g) <- c("a", "b", "c", "d")
pairwise.fc(x, g)

## some small checks
res <- by(x, list(g), mean)
2^(res[[1]] - res[[2]]) # a vs. b
-1/2^(res[[1]] - res[[3]]) # a vs. c
2^(res[[1]] - res[[4]]) # a vs. d
-1/2^(res[[2]] - res[[3]]) # b vs. c
-1/2^(res[[2]] - res[[4]]) # b vs. d
2^(res[[3]] - res[[4]]) # c vs. d

MKomics documentation built on Aug. 8, 2021, 5:06 p.m.