Learn R Programming

metRology (version 0.9-16.1)

boxplot.mandel.kh: Box plot of Mandel's h or k statistics

Description

Produces a box plot of Mandel's statistics, with optional outlier labels and indicator lines for unusual values.

Usage

## S3 method for class 'mandel.kh':
boxplot(x, probs=c(0.95, 0.99), main,  
		xlab=attr(x, "grouped.by"), ylab=attr(x, "mandel.type"),
		separators=FALSE, zero.line=TRUE, ylim,  p.adjust="none", 
		frame.plot = TRUE, horizontal=FALSE, at,
		... , 
		col.ind=1, lty.ind=c(2,1), lwd.ind=1, 
		col.sep="lightgrey", lwd.sep=1, lty.sep=1,
		lwd.zero=1, col.zero=1, lty.zero=1,
		outlier.labels=row.names(x), cex.lab=0.7, col.lab=1, 
		adj=NULL, pos=NULL, srt=0 )

Arguments

x
An object of class "mandel.kh"
probs
Indicator lines are drawn for these probabilities. Note that probs is interpreted as specifying two-tailed probabilities for Mandel's h and one-sided (upper tail) probabilities for Mandel's k.
main
a main title for the plot. If missing, the default is paste(deparse(substitute(x)), "- Mandel's", attr(x, "mandel.type"), if(attr(x, "mandel.method") == "robust") "(Robust variant)")
xlab
a label for the x axis; defaults to the grouped.by attribute for x.
ylab
a label for the x axis; defaults to the mandel.type attribute for x.
separators
Logical; if TRUE, separator lines are drawn between groups of values.
zero.line
logical; if TRUE a horizontal line is drawn at zero.
ylim
the y limits of the plot. For Mandel's k, the default lower limit for y is zero.
p.adjust
Correction method for probabilities. If not "none", passed to p.adjust prior to calculating indicator lines. Usually, indicator lines are drawn without correction (that is, with p.adjust="none"); specifying a p-
frame.plot
Logical; If TRUE a box is drawn around the plot.
horizontal
if TRUE boxes are plotted horizontally and separators, indicators etc adjusted accordingly.
at
numeric vector giving the locations where the boxplots should be drawn; defaults to 1:n where n is the number of boxes.
...
Other (usually graphical) parameters passed to barplot. Note that some parameters appear after ...to prevent spurious argument matching inside barplot.default.
col.ind, lty.ind, lwd.ind
Graphical parameters used for the indicator lines, recyckled to length(probs). For attr(x, "mandel.type")=="h" the graphical parameters are applied to negative as well as positive indicator lines, applied outwards from zero.
col.sep, lwd.sep, lty.sep
Graphical parameters used for the separator lines.
lwd.zero, col.zero, lty.zero
Graphical parameters used for the zero line.
outlier.labels
Either a logical indicating whether outliers should be labelled or a character vector of length nrow(x) giving labels. Defaults to row.names(x).
cex.lab, col.lab
Character size and colour for outlier labels, passed to text as col and cex respectively.
adj, pos
Position of outlier labels relative to outliers; passed to text.
srt
Label rotation, in degrees, for outlier labels; passed to text.

Value

  • boxplot.mandel.kh returns the box plot statistics returned by boxplot, invisibly.

Details

This plot produces a box plot (using boxplot.default) of the variables in an object of class "mandel.kh". If labels are specified for outliers (the default), outliers are first located based on the locations given by boxplot.default. WARNING: ties may be mislabelled, as the label allocated will be the _first_ point at that location. Indicator lines are, if requested, drawn as for plot.mandel.kh. Vertical separators are drawn at midpoints of at. If

See Also

link{boxplot} for box plot argumants, and link{text} for outlier label location, colour and rotation. mandel.h, mandel.k, mandel.kh, pmandelh, pmandelk for probabilities, quantiles etc. See plot.mandel.kh for the 'classic' Mandel plot.

Examples

Run this code
data(RMstudy)

   h <- with(RMstudy, mandel.h(RMstudy[2:9], g=Lab))
   boxplot(h, las=2) 
   	#Recall that for normally distributed data mandel's h should 
   	#have the same dispersion (and IQR) for all groups. But outliers adversely 
   	#affect the estimate of dispersion, so the interquartile ranges differ.
   	#The same effect also accounts for the many boxplot outliers visible
   	#inside the classical Mandel indicator lines; the indicators also 
   	#assume normality.
   	
   #with separators:
   boxplot(h, las=2, separators=TRUE)
   
   #With different labels and label colours:
   boxplot(h, las=2, outlier.labels=paste(1:nrow(h)), col.lab=1:5) 
   
   #... and a horizontal variant (note use of pos to change label positions)
   par(omd=c(0.1,1,0,1))		#to make room for axis labels
   boxplot(h, las=1, separators=TRUE, horizontal=TRUE, pos=1)

Run the code above in your browser using DataLab