% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/QC.R
\name{computeSpatialOutlier}
\alias{computeSpatialOutlier}
\title{computeSpatialOutlier}
\usage{
computeSpatialOutlier(
  spe,
  computeBy = NULL,
  method = c("mc", "scuttle", "both"),
  mcDoScale = FALSE,
  scuttleType = c("both", "lower", "higher")
)
}
\arguments{
\item{spe}{a SpatialExperiment object with quantitative cell metrics in the `colData`.}

\item{computeBy}{character indicating a `colData` column name to compute the outliers on.}

\item{method}{one of `mc`, `scuttle`, `both`.
Use `mc` for medcouple, `scuttle` for MAD as computed in `scuttle`, `both` 
for computing both of them.}

\item{mcDoScale}{logical indicating if the metric values should be scaled 
to compute medcouple (default is FALSE, as suggested by the original medcouple 
authors). See \link[robustbase]{mc} for further readings.}

\item{scuttleType}{One of `"both"`, `"lower"`, `"higher"` for scuttle method.}
}
\value{
a SpatialExperiment object with additional column(s) (named as
the column name indicated in `computeBy` followed by the outlier_sc/mc).
Resulting columns are `outlier.filter` logical class objects, allowing to store 
the thresholds as attributes of the columns.
Use attr(,"thresholds") to retrieve them.
}
\description{
Computes outliers for quantitative cell metadata based on a statistical test:
medcouple (`mc` method argument) or the Median Absolute Deviation (MAD, `scuttle` 
method argument), when the metric distribution is respectively asymmetric or symmetric.
}
\details{
The medcouple method is a measure for the skeweness of univariate
distribution as described in Hubert M. et al. (2008).
In particular, the computed medcouple value must be in a range between -0.6
and 0.6 to compute adjusted boxplots and perform the outlier detection.
For MAD method we just wrap the isOutlier function in the scuttle package. 
Please see McCarthy DJ et al (2017) for further details.
}
\examples{
example(spatialPerCellQC)
spe <- computeSpatialOutlier(spe, computeBy="log2SignalDensity", method="both")
table(spe$log2SignalDensity_outlier_mc)
table(spe$log2SignalDensity_outlier_sc)
}
