youden.plot: Youden plots

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

Description

A Youden plot is a bivariate scatter plot, named for its use by W. M Youden in interlaboratory studies. This implementation includes data ellipses based on Pearson, Spearman, Kendall or several robust covariance measures.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
youden.plot(x, ...)

yplot(x, ...)

## Default S3 method:
youden.plot(x, y = NULL, type = c("points", "labels", "both", "outliers"), 
	labels, probs = c(0.95, 0.99), x0, y0,  pch = par("pch"), cex = par("cex"), 
	col = par("col"), bg = par("bg"), main, xlab, ylab,  
	xlim = c("data", "ellipse", "all"), ylim = c("data", "ellipse", "all"), 
	col.axes = 2, lwd.axes = 1, lty.axes = 1, cex.lab = 0.7, pos = 3, 
	out.method = c("F", "chisq", "n"), n.out, p.out = 0.99, 
	add = FALSE,  ...)

Arguments

x

An R numeric object. Can be a vector (in which case y must be specified and of the same length) or a two-column numeric matrix.

y

A numeric vector of the same length as x. It is an error to provide y in addition to a two-column matrix for x.

type

The type of plot produced. See Details.

labels

Character vector of text labels for data points. Defaults to row.names(x) if x is a matrix or data frame with row names, names(x) if x is a named vector, and to 1:length(x) or 1:nrow(x) as appropriate if x does not have names.

probs

Numeric vector of probabilities for data ellipses.

x0, y0

If specified, data ellipses will be centred on (x0, y0) instead of using the location calculated from the data.

pch, cex, col, bg

passed to points; see points for details.

main, xlab, ylab

Plot titles. If missing, titles are based on the names of the objects plotted.

xlim, ylim

Specifications for horizintal and vertical plot limits. Each can be either a length 2 numeric vector (as usual) or a character value matching one of "data", "ellipse" or "all". If "data", the relevant limits are set to include the range of the data. If "ellipse", the relevant limits are set to include the whole of the outermost ellipse. If "all", limits are set to include both the data and the outermost ellipse.

col.axes, lwd.axes, lty.axes

Colour, line width and line type for vertical and horizontal location markers drawn through the ellipse centre.

cex.lab

Size for data point labels; see text for details.

pos

a position specifier for data point labels; see text for details.

out.method

Character specifying outlier marking. See Details.

n.out

Number of outliers marked if out.method=="n".

p.out

Confidence level at which points are marked as outliers if out.method is one of "F" or "chisq".

add

If TRUE, ellipses and points are added to an existing plot.

...

Named arguments passed to other functions. In particular:

  • Arguments cov.method, cov.control, scalefn, and locfn will be passed to cov.dellipse to control the (optionally robust) location, scale and covariance estimates used for the ellipses.

  • Arguments sub, ann, axes, frame.plot, and asp are passed to plot to add a sub-title, control axes and annotation and, importantly, control the plot aspect ratio.

  • Arguments col.ellipse, lty.ellipse, lwd.ellipse, fill, density, angle, npoints, prinax, col.prinax, lty.prinax, and lwd.prinax are passed to plot.d.ellipse to control the appearance of ellipses and ellipse principal axes.

Details

type controls the type of plot produced. Allowed types and their effect are:

points

Points only are drawn.

labels

Point labels only are drawn

both

Points are drawn with labels

outliers

Points are drawn and outlying points are labelled (see below)

Ellipses are constructed based on a location and covariance matrix constructed from the data by the method specified by cov.method. probs specifies the approximate coverage. See data.ellipse for details of covariance methods and ellipse specification.

The outlier identification method, if any, is specified by out.method and controlled by one of n.out or p.out. If out.method is "F" or "chisq", points with Mahalanobis distance greater than an upper critical value with probability p.out are considered to be outliers. The critical values used are

"F"

Mahalanobis distance greater than 2 * (n-1) * qf(p.out, 2, n-1) / (n-2)

"chisq"

Mahalanobis distance greater than qchisq(p.out, 2)

which( md > 2 * (n-1) * qf(p.out, 2, n-1) / (n-2) ) #F dist The Mahalanobis distance is calculated based on the covariance matrix used to consstruct plot ellipses.

If out.method is "n", the outermost n.out points (judged by Mahalanobis distance) are marked as outliers. Specifying out.method="n" and n.out=0 suppresses outlier identification. If outliers are marked, a list of marked outliers is included in the returned list (see Value, below).

yplot is an alias for youden.plot

Value

Invisibly returns the plotted data ellipses as an object of class d.ellipse.

Author(s)

S L R Ellison (s.ellison@lgcgroup.com)

References

Youden, W.J. and Steiner, E.H. (1975) Statistical Manual of the AOAC. AOAC International, Washington, US. ISBN 0-935584-15-3

ISO 13528:2005, Statistical methods for use in proficiency testing by interlaboratory comparisons, International Organization for Standardization, Geneva (2005)

See Also

d.ellipse

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
data(chromium)
data(potassium)

( yy <- youden.plot(chromium, main="Chromium") )

#With outlier ID (F based)
youden.plot(chromium, main="Chromium", xlim='a', ylim='a', type='o', p.out=0.95)
	#Note use of xlim="a" etc. to ensure both ellipses and data are included.
	
#Top 5 most distant outliers (5 is also the default)
youden.plot(chromium, main="Chromium", xlim='a', ylim='a', type='o', out.method="n", n.out=5)

#With ellipse principal axes
#(useful to specify asp=1 or the axes will not always appear orthogonal)
youden.plot(chromium, main="Chromium", 
	xlim='a', ylim='a', type='o', p.out=0.99, prinax=TRUE, lty.prinax=2, asp=1.0)

youden.plot(potassium, main="Potassium")

#A different pairs plot ...
panel.youden <- function(x, y, ...) youden.plot(x, y, add=TRUE, type="o", cex=1, pos=1, p.out=0.95)
pairs(chromium, upper.panel=panel.youden)

metRology documentation built on May 2, 2019, 12:20 p.m.