mbecLM: Linear (Mixed) Model Feature to Batch Fit

Description Usage Arguments Details Value Examples

View source: R/mbecs_helper.R

Description

Helper function that fits lm/lmm with covariates 'treatment' and 'batch' to every feature in the data-set. Returns the fdr corrected significance value for the "treatment" variable. The method 'lm' will fit the linear model y ~ model.vars[1] + model.vars[2] and the linear mixed model will consider the second term as random effect, i.e., y ~ model.vars[1] + (1|model.vars[2]).

Usage

1
2
3
4
5
6
7
mbecLM(
  input.obj,
  method = c("lm", "lmm"),
  model.vars = c("batch", "group"),
  type = "clr",
  label = character()
)

Arguments

input.obj

MbecData object

method

Either 'lm' or 'lmm' for linear models and linear mixed models.

model.vars

Covariates of interest, first relates to batch and second to treatment.

type

Which abundance matrix to use, one of 'otu, tss, clr, cor'. DEFAULT is clr' and the use of 'cor' requires the parameter label to be set as well.

label

Which corrected abundance matrix to use for analysis in case 'cor' was selected as type.

Details

The function returns either a plot-frame or the finished ggplot object. Input for th data-set can be an MbecData-object, a phyloseq-object or a list that contains counts and covariate data. The covariate table requires an 'sID' column that contains sample IDs equal to the sample naming in the counts table. Correct orientation of counts will be handled internally.

Value

A vector of fdr corrected p-values that show significance of treatment for every feature

Examples

1
2
3
# This will return p-value for the linear model fit of every feature.
val.score <- mbecLM(input.obj=dummy.mbec, model.vars=c("batch","group"),
method="lm")

buschlab/MBECS documentation built on Jan. 21, 2022, 1:27 a.m.