eigenVariable: Association of eigen vectors with variables

Description Usage Arguments Value See Also Examples

Description

This function calculates P values for association of any number of eigen vectors with the metadata variables. Method: anova(lm(eigen vector ~ variable))$"Pr(>F)"[1]

Usage

1
eigenVariable(pcs, tech.vars)

Arguments

pcs

a matrix with eigen vectors, i.e. V matrix of an SVD

tech.vars

data frame with the metadata variables

Value

result

Matrix with the P values where columns are the eigen vectors and the rows are the variables from the metadata

plot

ggplot object for a tile plot reflecting significant associations

See Also

anova

Examples

1
2
3
4
5
6
7
8
9
u <- matrix(runif(120), ncol = 3)
library(ggplot2)
var.test <- data.frame(batch = sample(c("a", "b"), 40, replace = TRUE),
                       age = sample(50:85, size = 40, replace = TRUE),
                       amp.plate = sample(c("A1", "B1", "C1", "D1", "E1"), 40, replace = TRUE),
                       height = sample(60:72, 40, replace = TRUE))
res <- eigenVariable(u, var.test)
print(res$result)
plot(res$plot)

moosik/snorm documentation built on May 23, 2019, 6:11 a.m.