stats.util: Statistical Summary Utilities for Two-Classes Data

stats.utilR Documentation

Statistical Summary Utilities for Two-Classes Data

Description

Functions to summarise two-group data.

Usage

stats.vec(x,y, method="mean",test.method = "wilcox.test",fc=TRUE,...)
stats.mat(x,y, method="mean",test.method = "wilcox.test",
          padj.method= "fdr",fc=TRUE,...)

Arguments

x

A data frame or matrix of data set for stats.mat or data vector for stats.vec.

y

A factor or vector of class. Two classes only.

method

method for group center such as mean or median.

test.method

method for p-values from parametric test such as t.test or non-parametric test such as wilcox.test.

padj.method

method for p-values correction. Can be one in p.adjust.methods: "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr" and "none".

fc

a flag for fold-change.

...

Additional parameters.

Value

stats.vec returns an vector of center, group center, fold change, log2 fold change, AUC and p-value.

stats.mat, which is an wrapper function of stats.vec, returns an data frame of center, group center, fold change, log2 fold-change, AUC, p-value and adjusted p-values.

Note

If x has negative values, the results of fold-change and log2 fold-change are not reliable.

Author(s)

Wanchang Lin

Examples

data(iris)
sel <- c("setosa", "versicolor")
grp <- iris[,5]
idx <- match(iris[,5],sel,nomatch = 0) > 0

cls <- factor(iris[idx,5])
dat <- iris[idx,1:4]

## stats for the single vector
stats.vec(dat[[1]],cls, method = "median",test.method = "wilcox.test")

## use matrix format
tab <- stats.mat(dat,cls, method = "median",test.method = "wilcox.test",
                 padj.method = "BH")
sapply(tab, class)


mt documentation built on June 22, 2024, 12:24 p.m.