Skip to contents

Provides a detailed summary of the outlier detection results from remove.knn.outliers.

Usage

# S3 method for class 'knn.outliers'
summary(object, ...)

Arguments

object

An object of class "knn.outliers" as returned by remove.knn.outliers.

...

Additional arguments (currently unused).

Value

A list of class "summary.knn.outliers" containing summary statistics.

Examples

knn.res <- list(
  S.q = matrix(c(0, 0,
                 1, 1,
                 2, 2), ncol = 2, byrow = TRUE),
  y.q = c(1.0, 1.5, 2.0),
  nn.d = matrix(c(0.2, 0.4,
                  0.3, 0.5,
                  1.4, 1.8,
                  0.25, 0.45),
                ncol = 2, byrow = TRUE),
  d.thld = 1,
  idx = c(TRUE, TRUE, FALSE, TRUE),
  n.outliers = 1L,
  method = "qf"
)
class(knn.res) <- "knn.outliers"

summary(knn.res)
#> 
#> k-Nearest Neighbor Outlier Detection Summary
#> =============================================
#> 
#> Method: qf 
#> Distance threshold: 1 
#> 
#> Data Summary:
#>   Total observations: 4 
#>   Outliers detected: 1 (25.0%) 
#>   Observations retained: 3 (75.0%) 
#> 
#> Nearest Neighbor Distance Summary:
#>           NN1    NN2
#> Min    0.2000 0.4000
#> Q1.25% 0.2375 0.4375
#> Median 0.2750 0.4750
#> Mean   0.5375 0.7875
#> Q3.75% 0.5750 0.8250
#> Max    1.4000 1.8000
#> 
#> First Nearest Neighbor Distances:
#>   Retained points:
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>   0.200   0.225   0.250   0.250   0.275   0.300 
#>   Outlier points:
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>     1.4     1.4     1.4     1.4     1.4     1.4