met2batch: batch effect on numeric matrix

View source: R/met2batch.R

met2batchR Documentation

batch effect on numeric matrix

Description

This function estimates the effects of a categorical (batch) variable on a matrix of features in univariate linear models.

Usage

met2batch(wdata, batch)

Arguments

wdata

the numeric data matrix with samples in row, features in columns

batch

a single vector containing a vector based batch variable

Value

a list object of length two with (1) a data frame of summary statistics on (a) the number of tested features ,(b) the mean batch effect across all features ,(c) the mean batch effect across all associated (BH FDR<0.05) features ,(d) the number of associated (BH FDR<0.05) features.

Examples

d1 = sapply(1:10, function(x){ rnorm(50, 30, 5) })
d2 = sapply(1:10, function(x){ rnorm(50, 40, 5) })
ex_data = rbind(d1, d2)
d3 = sapply(1:10, function(x){ rnorm(100, 40, 5) })
ex_data = cbind(ex_data, d3)
lot = c( rep("A",50), rep("B",50) )
ex = met2batch(wdata = ex_data, batch = lot)


MRCIEU/metaboprep documentation built on Jan. 28, 2023, 7:29 p.m.