Learn R Programming

nexus (version 0.3.0)

plot_outlier: Plot Outliers

Description

Plot Outliers

Usage

# S4 method for OutlierIndex,missing
plot(
  x,
  ...,
  type = c("dotchart", "distance"),
  robust = TRUE,
  colors = color("discreterainbow"),
  symbols = c(16, 1, 3),
  xlim = NULL,
  ylim = NULL,
  xlab = NULL,
  ylab = NULL,
  main = NULL,
  sub = NULL,
  ann = graphics::par("ann"),
  axes = TRUE,
  frame.plot = axes,
  panel.first = NULL,
  panel.last = NULL,
  legend = list(x = "topleft")
)

Value

plot() is called for its side-effects: is results in a graphic being displayed (invisibly return x).

Arguments

x

An OutlierIndex object.

...

Further graphical parameters.

type

A character string specifying the type of plot that should be made. It must be one of "dotchart" or "distance". Any unambiguous substring can be given.

robust

A logical scalar: should robust Mahalanobis distances be displayed? Only used if type is "dotchart".

colors

A vector of colors or a function that when called with a single argument (an integer specifying the number of colors) returns a vector of colors. Will be mapped to the group names.

symbols

A lenth-three vector of symbol specification for non-outliers and outliers (resp.).

xlim

A length-two numeric vector giving the x limits of the plot. The default value, NULL, indicates that the range of the finite values to be plotted should be used.

ylim

A length-two numeric vector giving the y limits of the plot. The default value, NULL, indicates that the range of the finite values to be plotted should be used.

xlab, ylab

A character vector giving the x and y axis labels.

main

A character string giving a main title for the plot.

sub

A character string giving a subtitle for the plot.

ann

A logical scalar: should the default annotation (title and x and y axis labels) appear on the plot?

axes

A logical scalar: should axes be drawn on the plot?

frame.plot

A logical scalar: should a box be drawn around the plot?

panel.first

An an expression to be evaluated after the plot axes are set up but before any plotting takes place. This can be useful for drawing background grids.

panel.last

An expression to be evaluated after plotting has taken place but before the axes, title and box are added.

legend

A list of additional arguments to be passed to graphics::legend(); names of the list are used as argument names. If NULL, no legend is displayed.

Author

N. Frerebeau

References

Filzmoser, P., Garrett, R. G. & Reimann, C. (2005). Multivariate outlier detection in exploration geochemistry. Computers & Geosciences, 31(5), 579-587. tools:::Rd_expr_doi("10.1016/j.cageo.2004.11.013").

Filzmoser, P. & Hron, K. (2008). Outlier Detection for Compositional Data Using Robust Methods. Mathematical Geosciences, 40(3), 233-248. tools:::Rd_expr_doi("10.1007/s11004-007-9141-5").

Filzmoser, P., Hron, K. & Reimann, C. (2012). Interpretation of multivariate outliers for compositional data. Computers & Geosciences, 39, 77-85. tools:::Rd_expr_doi("10.1016/j.cageo.2011.06.014").

See Also

Other outlier detection methods: detect_outlier()

Examples

Run this code
## Data from Day et al. 2011
data("kommos", package = "folio") # Coerce to compositional data
kommos <- remove_NA(kommos, margin = 1) # Remove cases with missing values
coda <- as_composition(kommos, parts = 3:17, groups = 1)

## Detect outliers
out <- detect_outlier(coda)

plot(out, type = "dotchart")
plot(out, type = "distance")

## Detect outliers according to CJ
ref <- extract(coda, "CJ")
out <- detect_outlier(coda, reference = ref, method = "mcd")
plot(out, type = "dotchart")

Run the code above in your browser using DataLab