DA.zpo: Zero inflated Poisson glm

View source: R/DA.zpo.R

DA.zpoR Documentation

Zero inflated Poisson glm

Description

Apply zero-inflated poisson generalized linear model for multiple features, with one predictor as independent variable. With log(librarySize) as offset when relative=TRUE.

Usage

DA.zpo(
  data,
  predictor,
  covars = NULL,
  relative = TRUE,
  out.all = NULL,
  p.adj = "fdr",
  coeff = 2,
  coeff.ref = 1,
  allResults = FALSE,
  ...
)

Arguments

data

Either a matrix with counts/abundances, OR a phyloseq object. If a matrix/data.frame is provided rows should be taxa/genes/proteins and columns samples

predictor

The predictor of interest. Either a Factor or Numeric, OR if data is a phyloseq object the name of the variable in sample_data(data) in quotation

covars

Either a named list with covariables, OR if data is a phyloseq object a character vector with names of the variables in sample_data(data)

relative

Logical. Whether log(librarySize) should be used as offset. Default TRUE

out.all

If TRUE will output results and p-values from drop1. If false will output results for 2. level of the predictor. If NULL (default) set as TRUE for multi-class predictor and FALSE otherwise

p.adj

Character. P-value adjustment. Default "fdr". See p.adjust for details

coeff

Integer. The p-value and log2FoldChange will be associated with this coefficient. Default 2, i.e. the 2. level of the predictor.

coeff.ref

Integer. Reference level of the predictor. Will only affect the log2FC and ordering columns on the output. Default the intercept, = 1

allResults

If TRUE will return raw results from the zeroinfl function

...

Additional arguments for the zeroinfl function

Value

A data.frame with with results.

Examples

# Creating random count_table and predictor
set.seed(4)
mat <- matrix(rnbinom(1000, size = 0.1, mu = 500), nrow = 100, ncol = 10)
rownames(mat) <- 1:100
pred <- c(rep("Control", 5), rep("Treatment", 5))
 
# Running Zero-inflated Poisson regression on each feature
res <- DA.zpo(data = mat, predictor = pred)

Russel88/DAtest documentation built on March 24, 2022, 3:50 p.m.