Hi,
The paper states that "small-sample correction factors which make MADn ...
unbiased" are used. Dr Rousseeuw provided the original source code which confirms that the factors from this paper were used.
An implementation of this could look like
madfc <- function(x) {
x <- x[!is.na(x)] # Remove NAs
n <- length(x)
bn <- if (n == 2) {
1.196
} else if (n == 3) {
1.495
} else if (n == 4) {
1.363
} else if (n == 5) {
1.206
} else if (n == 6) {
1.200
} else if (n == 7) {
1.140
} else if (n == 8) {
1.129
} else if (n == 9) {
1.107
} else if (n > 9) {
n / (n - 0.8)
} else {
1
}
mad_fc <- mad(x) * bn
return(mad_fc)
}
And in robLoc/robScale "mad" would be replaced by "madfc".
Best, Filip
Hi,
The paper states that "small-sample correction factors which make MADn ...
unbiased" are used. Dr Rousseeuw provided the original source code which confirms that the factors from this paper were used.
An implementation of this could look like
madfc <- function(x) {
x <- x[!is.na(x)] # Remove NAs
n <- length(x)
bn <- if (n == 2) {
1.196
} else if (n == 3) {
1.495
} else if (n == 4) {
1.363
} else if (n == 5) {
1.206
} else if (n == 6) {
1.200
} else if (n == 7) {
1.140
} else if (n == 8) {
1.129
} else if (n == 9) {
1.107
} else if (n > 9) {
n / (n - 0.8)
} else {
1
}
mad_fc <- mad(x) * bn
return(mad_fc)
}
And in robLoc/robScale "mad" would be replaced by "madfc".
Best, Filip