detectOutliers: Detect outlier cells

View source: R/outlier-detection.R

detectOutliersR Documentation

Detect outlier cells

Description

There are several methods according to which outlier cells can be detected or defined. Which one to use strongly depends on the researchers question at hand. See details for more information on which method does what exactly.

Usage

detectOutliers(
  object,
  method_outlier = "iqr",
  threshold_pval = 0.001,
  variable_names = NULL,
  across = NULL,
  phase = NULL,
  verbose = NULL
)

Arguments

object

A valid cypro object.

method_outlier

Character vector. Specifies the method/algorithm of interest.

Use validOutlierDetectionMethods() to obtain all valid input options.

across

Character value, character vector or NULL (see details for more). Specifies the grouping variable of interest.

Use getGroupingVariableNames() to obtain all variable names that group the cells of your experiment in a certain manner.

phase

Character or numeric. If character, the ordinal value referring to the phase of interest (e.g. 'first', 'second' etc.). referring to the phase of interest or 'all'. If numeric, the number referring to the phase.

If set to NULL takes the phase denoted as default with adjustDefault().

Ignored if the experiment design contains only one phase.

verbose

Logical. If set to TRUE informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

Details

This function only detects outliers. It does not remove them from the object. Use removeOutliers() for that matter. To get more insights in the outlier detection results before removing them use getOutlierResults().

Method: Interquartile Range (iqr)

Every stat variable denoted in argument variable_names is screened via R's built in function grDevices::boxplot.stats(). Every ID that is recognized as an outlier is stored in a list slot named after the stat variable under which it was detected as an outlier.

Method: mahalanobis

Multivariate outlier detection method. Mahalanobis distance is computed including all stat variables denoted in argument variable_names via stats::mahalanobis(). P-values are calculated via stats::pchisq() and cells are filtered according to the threshold set with argument threshold_pval. Cells with a mahalanobis distance p-value lower or equal than the threshold are defined as outliers.

Value

An updated version of the input cypro-object.

See Also

removeOutliers()


theMILOlab/cypro documentation built on April 5, 2022, 2:03 a.m.