findOutliers: Identify outlier objects given a square distance matrix.

Description Usage Arguments Value Author(s) Examples

View source: R/taxTools.R

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

1
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.

Author(s)

Noah Hoffman

Examples

1
2
3
4
5
6
7
8
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)

Example output

Loading required package: clst
Loading required package: rjson
Loading required package: ape
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
0.000000 0.003358 0.005975 0.011041 0.013277 0.144397 
outliers
FALSE  TRUE 
  103     8 

clstutils documentation built on Nov. 8, 2020, 5:23 p.m.