horn.outliers: Determines outliers using Horn's method and Tukey's...

Description Usage Arguments Value Author(s) References Examples

View source: R/referenceIntervals.R

Description

This function determines outliers in a Box-Cox transformed dataset using Horn's method of outlier detection using Tukey's interquartile fences. If a data point lies outside 1.5 * IQR from the 1st or 3rd quartile point, it is an outlier.

Usage

1

Arguments

data

A vector of data points.

Value

Returns a list containing a vector of outliers and a vector of the cleaned data (subset).

outliers

A vector of outliers from the data set

subset

A vector containing the remaining data, cleaned of outliers

Author(s)

Daniel Finnegan

References

ASVCP reference interval guidelines: determination of de novo reference intervals in veterinary species and other related topics. Vet Clin Pathol 41/4 (2012) 441-453, 2012 American Society for Veterinary Clinical Pathology

Horn, P. S., Feng, L., Li, Y., & Pesce, A. J. (2001). Effect of outliers and nonhealthy individuals on reference interval estimation. Clinical Chemistry, 47(12), 2137-2145.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
horn.outliers(set200)

## The function is currently defined as
function (data) 
{
    descriptives = summary(data)
    Q1 = descriptives[[2]]
    Q3 = descriptives[[5]]
    IQR = Q3 - Q1
    out = subset(data, data <= (Q1 - 1.5 * IQR) | data >= (Q3 + 
        1.5 * IQR))
    sub = subset(data, data > (Q1 - 1.5 * IQR) & data < (Q3 + 
        1.5 * IQR))
    return(list(outliers = out, subset = sub))
  }

Example output

Warning message:
no DISPLAY variable so Tk is not available 
$outliers
[1] 2.041466 7.694463 8.268451 2.911003 2.564337

$subset
  [1] 5.059228 5.510014 4.560486 3.412336 4.486563 5.176955 5.059038 6.327642
  [9] 4.069733 5.544904 6.042959 4.762022 4.560958 5.511004 5.050308 4.975724
 [17] 5.176190 6.773381 5.394553 4.285398 5.981332 5.537204 4.316582 3.711618
 [25] 4.587945 3.920116 5.302362 5.369132 4.991369 3.112459 6.344521 4.900301
 [33] 4.293336 4.554774 4.842411 6.603186 4.750048 4.783071 7.005361 4.569405
 [41] 3.760018 3.107277 3.781026 4.036052 5.932173 6.464148 4.414842 6.302841
 [49] 3.982319 5.963941 4.897853 5.347454 5.327615 5.413375 3.969233 4.177236
 [57] 6.991558 4.629782 4.939321 6.277979 3.998341 6.586531 5.462705 4.678516
 [65] 5.664181 5.871666 5.612786 4.958342 3.574970 5.707353 5.722616 5.109404
 [73] 5.525799 4.871382 5.975115 5.396220 5.009189 5.373929 4.489799 4.371069
 [81] 5.407118 4.593757 5.625868 4.672294 5.249131 4.652585 4.523871 5.762138
 [89] 5.225699 4.709873 5.312388 4.732623 3.253572 5.416163 5.335284 3.550132
 [97] 5.138487 4.948860 3.378901 5.558122 4.910735 4.944702 4.220747 5.215427
[105] 6.811377 3.867448 6.212026 4.600327 6.101862 6.359650 4.872534 5.005738
[113] 4.534093 5.294825 4.817925 4.775403 3.598499 4.494135 4.908363 4.367137
[121] 5.988439 4.022408 4.687549 5.266313 6.387985 5.912292 5.729304 5.229396
[129] 5.391634 4.403675 6.374985 4.659793 5.504519 4.960141 4.586609 4.303895
[137] 6.273943 5.391455 3.689035 5.165393 5.290608 4.031226 4.254576 4.736779
[145] 6.110430 5.279028 5.009280 4.180908 4.626821 4.737134 5.120588 4.515948
[153] 5.649651 4.266080 6.636057 4.559661 3.926237 4.852984 4.858273 5.492899
[161] 4.679599 4.773963 3.379104 6.870400 4.654591 3.241552 4.154844 4.888618
[169] 4.747308 3.589952 5.205409 6.639033 5.558554 4.667895 5.374570 5.684291
[177] 4.669748 6.212104 3.717901 5.764342 4.245232 4.642849 7.042638 4.160442
[185] 5.469145 4.750081 6.648001 5.985012 5.619236 6.120522 5.568739 5.124476
[193] 5.436815 6.481618 3.804273

function (data) 
{
    descriptives = summary(data)
    Q1 = descriptives[[2]]
    Q3 = descriptives[[5]]
    IQR = Q3 - Q1
    out = subset(data, data <= (Q1 - 1.5 * IQR) | data >= (Q3 + 
        1.5 * IQR))
    sub = subset(data, data > (Q1 - 1.5 * IQR) & data < (Q3 + 
        1.5 * IQR))
    return(list(outliers = out, subset = sub))
}

referenceIntervals documentation built on May 30, 2017, 3:08 a.m.