withinBatchFit: Fit a model separately to each batch in an experiment

View source: R/withinBatchFit.R

withinBatchFitR Documentation

Fit a model separately to each batch in an experiment

Description

withinBatchFit fits the model model to each row of feature abundances (in the assay matrix specified with assay) of x. This allows to perform a per-batch-separate estimation of injection order dependent signal drifts.

Usage

withinBatchFit(
  x,
  batch = x$batch,
  assay = "norm",
  model = y ~ injection_idx,
  method = "lmrob",
  minVals = 6,
  log.transform = TRUE
)

Arguments

x

SummarizedExperiment with the data on which the model should be fitted (feature-wise). To estimate the injection order dependent signal drift on only QC samples, 'x' should contain only the data for the QC samples of the experiment. It has to contain feature abundances and all required sample annotations (such as a variable for batch and one for the injection index).

batch

factor defining the batches.

assay

character(1) specifying the

model

model formula describing the model that should be fitted to the data within each batch.

method

character(1) specifying the method that should be used to fit the model. Can be either "lmrob" for robust regression or "lm" for least squares regression.

minVals

integer(1) with the minimum required data values for the model to be fitted.

log.transform

logical(1) whether feature abundances should be log2 transformed prior fitting of the model (default is log.transform = TRUE).

Value

list of length equal to the number of batches (levels of batch) each representing the model fits for one batch. res[[1]] is thus the result for the first batch and is a list of fitted models, one for each feature.

Author(s)

Johannes Rainer


EuracBiomedicalResearch/CompMetaboTools documentation built on Jan. 31, 2024, 1:14 p.m.