Learn R Programming

clst (version 1.20.0)

findOutliers: Identify outlier objects given a square distance matrix.

Description

Outliers are defined as elements with edge length to the centermost element > cutoff. The distance threshold (cutoff) can be either specified, or calculated as a quantile of all pairwise distances in the matrix.

Usage

findOutliers(mat, quant, cutoff)

Arguments

mat
square matrix of distances
quant
given all pairwise distances x, calculate distance threshold as quantile(x, quant). Values closer to 0 are more stringent.
cutoff
an absolute cutoff overriding quant

Value

  • Returns a boolean vector corresponding to margin of mat; outliers have a value of TRUE.

Examples

Run this code
library(ape)
data(seqs)
data(seqdat)
dmat <- ape::dist.dna(seqs[seqdat$tax_name == 'Enterococcus faecium',],
        pairwise.deletion=TRUE, as.matrix=TRUE, model='raw')
summary(dmat[lower.tri(dmat)])
outliers <- findOutliers(dmat, cutoff=0.015)
table(outliers)

Run the code above in your browser using DataLab