summarizett: Quick and dirty significance tests

Description Usage Arguments Details Value Examples

View source: R/summarizett.R

Description

summarizett Perform significance tests as defined across columns in a data.frame/matrix.

Usage

1
2
summarizett(dat, phenotype, maxgroups = 5, sig = 0.05,
  adjmethod = "bonferroni", num.test = wilcox.test, cl.test = fisher.test)

Arguments

dat

Data.frame/matrix with dsamples as rows and variables as columns.

phenotype

Vector of phenotypes. See details.

maxgroups

Maximum number of groups for contigency table test.

sig

P-value cut-off for making a significant call.

adjmethod

Method for p-value correction. Default: 'bonferroni'.

num.test

wilcox.test (default) or t.test

cl.test

fisher.test (default) or chisq.test

Details

This function allows the user to quickly analyze a set of variables against a set of samples with 2 or more phenotypes. Since a t.test or wilcox.test is used for continuous variables, variables with >2 phenotypes are restricted only to ordinal/categorical variables.

Input is a data.frame (preferably) or matrix where columns correspond to variables and rows correspond to samples. Depending on the class of the column, a different test is used. If the class is numeric, the defined num.test is used. If the class is factor/character, cl.test is used instead.

Adjusted p-values are calculated using defined adjmethod.

Value

A data.frame with the following columns:

pval:

p-value of the specific test.

sigp:

p < sig.

adjp:

adjusted p-value.

sigadj:

adjp < sig

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
pheno <- factor(sample(c('case','control'), 50, replace = TRUE))

dat <- matrix(rnorm(100),nrow = 50, ncol = 2)
dat <- cbind(dat, jitter(as.numeric(pheno)))
dat <- cbind(dat, sample(c('Pos','Neg'),50,replace = TRUE))
dat <- as.data.frame(dat, stringsAsFactors = FALSE)
colnames(dat) <- paste('Var',1:4,sep='_')

# Run summarizett. Var_3 is significant.
summarizett(dat, pheno)

sean-cho/toolkit documentation built on May 29, 2019, 4:24 p.m.