swh:1:snp:3a44eb759780145deea094ac2a25c5049546a085
Tip revision: 0cb67c5fe3386e44746c8148a7ecf4e10ee1a933 authored by Han Lin Shang on 29 November 2020, 05:20:02 UTC
version 6.0
version 6.0
Tip revision: 0cb67c5
Qn.R
Qn <- function(x)
{
n <- length(x)
diffs <- outer(x, x, "-")
diffs <- diffs[!lower.tri(diffs, diag = TRUE)]
qn <- 2.2219 * quantile(abs(diffs), 0.25)
if (n == 2)
dn <- 0.399
else if (n == 3)
dn <- 0.994
else if (n == 4)
dn <- 0.512
else if (n == 5)
dn <- 0.844
else if (n == 6)
dn <- 0.611
else if (n == 7)
dn <- 0.857
else if (n == 8)
dn <- 0.669
else if (n == 9)
dn <- 0.872
else if (n%%2 == 1)
dn <- n/(n + 1.4)
else dn <- n/(n + 3.8)
return(dn * qn)
}