BetweenGroup.test: BetweenGroup.test

View source: R/BetweenGroup.test.R

BetweenGroup.testR Documentation

BetweenGroup.test

Description

It runs standard univarate statistical tests (such as t.test, wilcox.test, oneway.test, kruskal.test) for all variates (columns) in the data.frame/data.matrix.

Usage

BetweenGroup.test(
  x,
  y,
  clr_transform = FALSE,
  p.adj.method = "bonferroni",
  positive_class = NA,
  q_cutoff = 0.2,
  paired = FALSE
)

Arguments

x

A data.martrix or data.frame including multiple numeric vectors.

y

A factor with two or more levels.

clr_transform

A logical value indicates if clr transformation before statistical analysis of compositional microbiome data.

p.adj.method

A string indicating the p-value correction method.

positive_class

A string indicating the specified class in the factor y.

q_cutoff

A number indicating the cutoff of q values after fdr correction.

paired

A logical indicating if paired between-group comparison is desired.

Value

...

Author(s)

Shi Huang

See Also

clr, t.test, wilcox.test, oneway.test, kruskal.test

Examples

x0 <- data.frame(t(rmultinom(16,160,c(.001,.5,.3,.3,.299))) + 0.65)
x <- data.frame(rbind(t(rmultinom(7, 75, c(.201,.5,.02,.18,.099))),
            t(rmultinom(8, 75, c(.201,.4,.12,.18,.099))),
            t(rmultinom(15, 75, c(.011,.3,.22,.18,.289))),
            t(rmultinom(15, 75, c(.091,.2,.32,.18,.209))),
            t(rmultinom(15, 75, c(.001,.1,.42,.18,.299)))))
# clr_x<-compositions::clr(x)
y<-factor(c(rep("A", 30), rep("B", 30)))
y1<-factor(c(rep("A", 15), rep("B", 15), rep("C", 15), rep("D", 15)))
system.time(BetweenGroup.test(x, y, clr_transform=FALSE))
system.time(BetweenGroup.test(x, y, clr_transform=TRUE))
system.time(BetweenGroup.test(x, y1, clr_transform=TRUE))
x_ <- data.frame(rbind(t(rmultinom(7, 7500, rep(c(.201,.5,.02,.18,.099), 100))),
            t(rmultinom(8, 7500, rep(c(.201,.4,.12,.18,.099), 100))),
            t(rmultinom(15, 7500, rep(c(.011,.3,.22,.18,.289), 100))),
            t(rmultinom(15, 7500, rep(c(.091,.2,.32,.18,.209), 100))),
            t(rmultinom(15, 7500, rep(c(.001,.1,.42,.18,.299), 100)))))
y_<-factor(c(rep("A", 30), rep("B", 30)))
y_1<-factor(c(rep("A", 15), rep("B", 15), rep("C", 15), rep("D", 15)))
system.time(BetweenGroup.test(x_, y_))
system.time(BetweenGroup.test(x_, y_1))

shihuang047/crossRanger documentation built on Feb. 7, 2023, 10:03 p.m.