mahaout: Multivariate outlier detection through the boxplot of the...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/mahaout.R

Description

This function finds multivariate outliers by constructing a boxplot of the Mahalanobis distance of all the instances.

Usage

1
mahaout(data, nclass=0, plot = TRUE)

Arguments

data

Name of the dataset

nclass

Number of the class to check for outliers. By default nclass=0 meaning the column of classes it is not used.

plot

Logical value. If plot=T a plot of the mahalanobis distance is drawn

Details

uses cov.rob function from the MASS library

Value

Returns a list of top outliers according to their Mahalanobis distance and a list of all the instances ordered according to their Mahalanobis distance.

If Plot=T, a plot of the instances ranked by their Mahalanobis distance is provided.

Author(s)

Edgar Acuna

References

Rousseeuw, P, and Leroy, A. (1987). Robust Regression and outlier detection. John Wiley & Sons. New York.

See Also

robout

Examples

1
2
3
#---- Detecting outliers using the Mahalanobis distance----
data(bupa)
mahaout(bupa,1)

Example output

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
Ouliers given by the boxplot of the  Mahalanobis distance
     190      316      317      345      183      335      205 
6.086927 6.012780 5.485214 4.923153 4.593790 4.570818 4.545537 

$outme
      190       316       317       345       183       335       205       344 
6.0869270 6.0127800 5.4852144 4.9231530 4.5937897 4.5708179 4.5455370 4.2024942 
      182        20       189       326       147       329        25       261 
4.0568638 4.0505847 3.9614804 3.8958487 3.6162559 3.5145043 3.4905725 3.4811485 
      212       171       244       312       175       211        13       313 
3.4707952 3.3669639 3.3592317 3.3269543 3.2568688 3.1628312 3.1081088 3.0735924 
      343        22       214       216       341       108        93       148 
3.0236523 3.0104647 2.9823482 2.9786114 2.9507142 2.9207325 2.9160372 2.8566967 
      168       106       109       195       315       167       197       172 
2.8240147 2.7685940 2.7236254 2.6820268 2.6283998 2.6099238 2.5907907 2.5698636 
       19       174       310       263       336        16       255       318 
2.5563034 2.5329674 2.5199009 2.5183164 2.5125160 2.4869933 2.4827986 2.4603330 
      141       145         1        90       210       199        12       311 
2.4603330 2.4368481 2.4280654 2.4171476 2.4166196 2.4045259 2.3990631 2.3796392 
      328       213        29        11       203        21       202        15 
2.3693979 2.3258815 2.3257734 2.3172070 2.3081688 2.2640408 2.2518049 2.1786098 
       24       209       308       257       176       170        92        23 
2.1777883 2.1421062 2.1089095 2.0050514 1.9664349 1.9664349 1.9625011 1.9454207 
      194        30       204       325       173       248       103       309 
1.9424737 1.9288353 1.9269791 1.8872413 1.8803202 1.8271817 1.8252828 1.8069088 
      217       105        27        26        75        76        34       200 
1.7880793 1.7800277 1.7648274 1.7605154 1.7456458 1.7412687 1.7394343 1.7386267 
      206       260       208         8        94        35        95       327 
1.7085441 1.7041195 1.6737069 1.6613477 1.6575071 1.6558873 1.6499815 1.6456628 
       33       273        31       272       150       143       262         9 
1.6434853 1.6222418 1.6037958 1.5955673 1.5813575 1.5813575 1.5576175 1.5448934 
      142       149        32       146        71       247       104       215 
1.5363369 1.5317674 1.5188995 1.5156180 1.5120174 1.4377252 1.4263715 1.4058906 
      258        96       131       196       249       314       245        14 
1.3974619 1.3860719 1.3836857 1.3821546 1.3752446 1.3424180 1.3123982 1.2967117 
      259       279       192       132       198       274        65       191 
1.2658659 1.2647672 1.2558676 1.2323007 1.2273560 1.2180533 1.1881817 1.1532593 
       28        73        18       144       201       256        10       207 
1.1528763 1.1428804 1.1205621 1.1203925 1.1164814 1.1026625 1.0947624 1.0797314 
        7        72        17       246        89       107        91        66 
1.0762663 1.0447104 1.0107455 1.0029742 0.9962773 0.8587913 0.7582189 0.7522820 
       74 
0.7494545 

dprep documentation built on May 29, 2017, 11:01 a.m.