I have the following function that stacks qq and histogram. I would like
to identify potential outliers on qq norm subplot.
The following code does not work. The error is that there are no points
within click range. I will appreciate suggestions on how to make this work
or
an existing function to do this.
truehist2() is just MASS truhist() without y axis.
function(data, label)
{
xlab = deparse(substitute(label))
par(usr = c(0, 1, 0, 1))
#c(xmin,xmax,ymin,ymax)
invisible(o.par)
o.par <- subplot(truehist2(data, xlab = xlab), x = c(0, 1), y =
c(0, 0.4))
o.usr <- o.par$usr
#Save coordinate of corners of main plot
qq <- qqnorm(data, plot = F)
x <- qq$y
y <- qq$x
Batch <- get("Batch", where = 2)
subplot(fun = expression({
par(usr = c(o.usr[1:2], 0, 1.04 * max(den.p$y)), xaxt =
"l")
plot(x, y, xlab = "", ylab = "Normal Quantiles", xaxt =
"n", xaxs = "e")
abline(lsfit(x, y))
box()
identify(x, y, Batch)
}
), x = c(0.04, 0.96), y = c(0.55, 1))
}
Thank you
Roy Robertson
Senior Research Statistician
Rohm and Haas, Co.
Spring House Technology Center
727 Norristown Road
PO Box 0904
Spring House, PA 19477-0904
7B, 207g
Voice: 215-619-5446
FAX: 215-619-1616
jroyrobertson@rohmhaas.com
"Opinions expressed are mine and not those of Rohm and Haas Company".
|