6
$\begingroup$

I understand that the scale factor for normally distributed data is 1.4826 to convert it to a pseudo standard deviation like quantity which could be used with the median for determining confidence levels as standard deviation is used with the mean. As I understood after reading on how this "1.4826" value is reached is that it is the the inverse of the 0.75 quantile for the standard normal distribution (the logic for 0.75 is in turn is that at this quantile, 50% of the standard normal CDF is covered).

Now hopefully after this brief introduction, i want to ask what if the data is not normally distributed or the data distribution is not known in advance. How to approach the scaling factor problem then? I referred a paper by leys at al. [2013]. and he mentioned that the scaling factor should be 1/80th quantile, but is that after standardising the data?? Also what is the logic behind the 80th percentile. Is that an empirical result?

$\endgroup$
4
  • $\begingroup$ The factor would be different for each type of distribution. When the type of distribution is known, simulation could provide an approximate result for a particular situation. $\endgroup$
    – BruceET
    Jul 25, 2018 at 16:50
  • $\begingroup$ Thanks bruceET. Can you elaborate on the meaning of simulation here, i.e. any resources on what is that. how to do it given that i find a distribution which most approximate my data using log-likelihood and AIC value and seeing that my final aim is to find a normalizing parameter only. (like 1.4826 for normal distribution) $\endgroup$ Jul 26, 2018 at 7:55
  • $\begingroup$ My Answer just now posted shows how to use simulation to find the conversion constant when the distribution family of the data is known. If it is unknown, you could divide the sample SD by MAD (const = 1) for several samples to get an approximate constant. $\endgroup$
    – BruceET
    Jul 26, 2018 at 16:56
  • $\begingroup$ I am not familiar with the 2013 paper you mention. I don't know the rationale for using the 80th percentile. However, if you look at the R documentation for mad you will see that the constant for the normal distribution is related to the 75th percentile. In R, 1/qnorm(.75) returns 1.482602. $\endgroup$
    – BruceET
    Jul 26, 2018 at 17:07

1 Answer 1

12
$\begingroup$

Definition: In R, the MAD of a vector x of observations is median(abs(x - median(x))) multiplied by the default constant you mention in your Question.

set.seed (726); x = round(rnorm(10, 100, 15))  # rounded-normal data
x
[1]  95  80 108  84 115  76  82  93 121 117

mad(x)
[1] 20.7564                  # default MAD in R
mad(x, const=1)
[1] 14                       # MAD with constant set to 1
median(abs(x-median(x)))
[1] 14                       # MAD using definition

The rationale for the constant $c = 1.4826$ is to put MAD on the same 'scale' as the sample standard deviation $S$ for large normal samples, in the sense that $E(S) \approx \sigma$ and $E(cD) \approx \sigma,$ where $S$ is the sample SD, $D$ is my notation for the sample MAD (without constant), and $\sigma$ is the SD of the normal population from which a large sample has been taken.

Illustrating with $n = 1000$ observations from $\mathsf{Norm}(\mu=100,\sigma=15):$

set.seed(725);  y = rnorm(1000, 100, 15)
sd(y);  mad(y)
[1] 14.64436         # sample SD, aprx pop SD 15
[1] 14.54209         # sample MAD, aprx same as sample and pop SD
mad(y, const=1)
[1] 9.808504         # MAD without constant multiple
sd(y)/mad(y, const=1)
[1] 1.493026         # Shows ratio aprx 1.4826

So with one normal sample of size $n =1000$ we have seen that a constant multiple of roughly 1.5 converts sample MAD $D$ to about the same scale as sample SD $S.$ We could get a more precise value for the constant by looking at many large normal samples.

[Note: If you use the same seed as shown, you will get exactly the same example. If you choose a different seed, or use no set.seed statement, you will get a fresh example.]

Uniform Data: If $U \sim \mathsf{Unif}(100-15\sqrt{3}, 100+15\sqrt{3}),$ then $E(U) = 100, SD(U) = 15.$

set.seed(1234);  u = runif(1000, 100-15*sqrt(3), 100+15*sqrt(3))
sd(u);  mad(u, const=1);  mad(u)
[1] 15.13162   # S
[1] 13.01111   # D
[1] 19.29028   # MAD with NORMAL constant
sd(u)/mad(u, const=1)
[1] 1.162977   # suggests UNIFORM const is aprx 1.16

So from one large uniform sample, we see that the constant for uniform data may be about $c = 1.16.$ Intuitively, it seems the same constant ought to work for all uniform populations. Here is a simulation using a 100,000 samples of size $n = 1000$ from a standard uniform distribution $\mathsf{Unif}(0,1).$ It shows the the constant for uniform data is about $c = 1.16.$ The 95% margin of simulation error for samples of size $n = 1000$ is about $\pm 0.0002.$ Larger samples might give a slightly different value.

m = 10^5;  n = 1000;  c = numeric(m)
for(i in 1:m) {
   u = runif(n);  s = sd(u);  d = mad(u, const=T)
   c[i] = s/d }
mean(c)
[1] 1.157575
2*sd(c)/sqrt(m)
[1] 0.0001560186

Exponential Data: An analogous simulation for exponential data gives $c \approx 2.08.$

Laplace Data: For random samples from a Laplace distribution the sample MAD is preferred to the sample SD as an estimate of the Laplace scale parameter. For Laplace data my simulation showed that $c \approx 2.04.$

$\endgroup$
7
  • $\begingroup$ this is exactly what i was seeking. Thanks for explaining the whole procedure in such a clear manner with all these example. The paper I was taking about was this " Detecting outliers: do not use standard deviation around the mean, use absolute deviation around the median" (biblio.ugent.be/publication/7065924). $\endgroup$ Jul 27, 2018 at 8:57
  • $\begingroup$ Also sorry for another question, but it's much more pertinent to what i'm dealing with. If i can get some insights (even a reference/paper) on how to deal with something like this) i can close this. So the thing is I understood the entire notion of what you explained above, why we take c=1 and why then we have to divide sd by mad in order to make it a consistent estimator. $\endgroup$ Jul 27, 2018 at 9:06
  • $\begingroup$ Now in your comments above you mentioned that if the distribution is unknown we can follow the same procedure for multiple samples drawn from the data and then find an approximate value for this normalising constant. So should this be like random sampling and also what type of sub-sample size should i look for if my overall data size is around 20000(not decided on it yet). $\endgroup$ Jul 27, 2018 at 9:14
  • $\begingroup$ The thing is i'm pulling in streaming data at 10 mins interval and wanted to calculate the median & MAD in order to determine whether the next point should be an outlier or not. So as per your advice, for finding the norm_constant i should make sub-samples from this data that i get on fly, calculate MAD & SD and then the constant and then continue this process for the next batch of 20000 observation and so on. right. Any example on this subsampling and what kind of approximation would you suggest. Thanks. $\endgroup$ Jul 27, 2018 at 9:18
  • 1
    $\begingroup$ Unless you feel the population from which the data come is continually changing in some fundamental way, your goal should be to find $c$ for your data and then use it for each batch. If $c$ fluctuates wildly, you should inquire why. Otherwise, maybe re-assess $c$ once every few months. // From your description, not sure what role MAD plays in your analysis. // For a different (or auxiliary) approaches, suggest you investigate 'control charts' and 'trimmed means'. // For detecting outliers, have you tried using simple boxplot outliers? $\endgroup$
    – BruceET
    Jul 27, 2018 at 14:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.