The Rosner (1975) method or the essence of the method, given the order statistics
RSlo(x, r, n=length(x))
The data values and note that base-10 logarithms of these are not computed internally;
The number of truncated observations; and
The number of observations.
The value for
Cohn, T.A., 2013--2016, Personal communication of original R source code: U.S. Geological Survey, Reston, Va.
Rosner, Bernard, 1975, On the detection of many outliers: Technometrics, v. 17, no. 2, pp. 221--227.
# NOT RUN {
# Long CPU time, arguments slightly modified to run faster and TAC had.
# TAC has maxr=n/2 (the lower tail) but WHA has changed to maxr=3 for
# speed to get the function usable during automated tests.
testMGBvsN3 <- function(n=100, maxr=3, nrep=10000) { # TAC named function
for(r in 1:maxr) {
set.seed(123457)
res1 <- replicate(nrep, { x <- sort(rnorm(n))
c(MGBTcohn2011(x,r),BLlo(x,r),RSlo(x,r)) })
r1 <- rank(res1[1,]); r2 <- rank(res1[2,]); r3 <- rank(res1[3,])
v <- quantile(r1,.1); h <- quantile(r2,.1)
plot(r1,r2)
abline(v=v, col=2); abline(h=h, col=2)
message(' BLlo ',r, " ", cor(r1,r2), " ", mean((r1 <= v) & (r2 <= h)))
v <- quantile(r1,.1); h <- quantile(r2,.1)
plot(r1,r3)
abline(v=v, col=2); abline(h=h, col=2)
mtext(paste0("Order statistic iteration =",r," of ",maxr))
message('RSTlo ',r, " ", cor(r1,r3), " ", mean((r1 <= v) & (r3 <= h)))
}
}
testMGBvsN3() #
# }
Run the code above in your browser using DataLab