Description Usage Arguments Details Value Author(s) References See Also Examples
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.
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, ...)
|
x |
An R |
y |
A numeric vector of the same length as |
type |
The type of plot produced. See Details. |
labels |
Character vector of text labels for data points. Defaults to |
probs |
Numeric vector of probabilities for data ellipses. |
x0, y0 |
If specified, data ellipses will be centred on |
pch, cex, col, bg |
passed to |
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 |
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 |
pos |
a position specifier for data point labels; see |
out.method |
Character specifying outlier marking. See Details. |
n.out |
Number of outliers marked if |
p.out |
Confidence level at which points are marked as outliers if |
add |
If |
... |
Named arguments passed to other functions. In particular:
|
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
Invisibly returns the plotted data ellipses as an object of class d.ellipse
.
S L R Ellison (s.ellison@lgcgroup.com)
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)
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.