# Significance Test for Interquartile Range

Is there a test that determines whether a statistically significant difference exists between the IQR of two or more independent sets of non-normally distributed continuous data?

Let's say I have a dataset from 2018 and 2019 looking at time to complete a customer order. The IQR for the 2018 dataset is different from 2019, but is it statistically significantly different?

• Is it possible that the time to complete a customer's order is exponentially distributed? In that case an estimate of the exponential mean $\mu$ gives you an estimate of the IQR: $\mathrm{IQR} = \mu(\ln(.75)-\ln(.25)).$ If $\mu=10,$ then in R,10*(log(.75)-log(.25)) and diff(qexp(c(.25,.75), 1/10)) both return 10.98612. So if the population means differ significantly, then so do the population IQR's. (It may help to recall that the mean of an exponential distribution is a scale parameter.) Commented May 14, 2020 at 6:32
• A simple approach would be a permutation or a bootstrap test. Commented May 14, 2020 at 6:36
• The IQR is the difference between the third and first quartiles. Testing for a difference would be rather a strange thing to do, because it asks whether this measure of spread of the distribution has changed, regardless of how the centers of the distributions might be situated. Is this really what you want to do, or are you trying to ask how to test the compound hypothesis that (a) the first quartiles are equal and (b) the third quartiles are equal?
– whuber
Commented May 14, 2020 at 12:56
• hi whuber, I'm trying to ask a more general question: has the variability in the process, completing a customer order, changed from 2018 to 2019. And if yes, why. Commented May 15, 2020 at 1:58

This post is not very new, but as I was looking for a similar thing, perhaps my solution helps somebody else... In base R, there are two tests for testing for the difference of scales (assuming idential location): (Westenberg-)Mood test (mood.test - well, it states "There are more useful tests for this problem.") and Ansari-Bradley test (ansari.test).

Btw., I got there via the discussion here, which then goes on to bootstrap methods. I found it helpful as it gives some quick background: https://stat.ethz.ch/pipermail/r-help/2012-July/318393.html

Example:

rr1 <- rnorm(100)
rr2 <- rnorm(100,10,3)
mood.test(rr1,rr2)
ansari.test(rr1,rr2)
mood.test(rr1-median(rr1),rr2-median(rr2))
ansari.test(rr1-median(rr1),rr2-median(rr2))