Calculate modified Z scores from a list of data or from the median and MAD, flag outliers with the Iglewicz–Hoaglin 3.5 rule, and compare with IQR fences.
Related Calculators
- Outlier Calculator
- Sigma To Percentage Calculator
- Coefficient of Skewness Calculator
- Cumulative Percentage Calculator
- All Statistics Calculators
Calculator Functions
| Function | What it does | What it requires |
|---|---|---|
| Modified Z scores from data | Finds the median, MAD and modified Z score of every value in a list and counts the potential outliers | Requires a list of observations |
| Modified Z score | Finds the modified Z score of one observation | Requires the observation, the median and the MAD |
| Observation from score | Finds the observation that has a given modified Z score | Requires the modified Z score, the median and the MAD |
| Median from score | Finds the median that gives an observation its modified Z score | Requires the observation, the modified Z score and the MAD |
| MAD from score | Finds the MAD that gives an observation its modified Z score | Requires the observation, the median and the modified Z score |
| Modified Z decision bounds | Finds the range of observations that are not flagged as potential outliers | Requires the median, the MAD and a threshold |
| IQR outliers from data | Finds the quartiles and IQR fences of a list and counts the values outside them | Requires a list of observations |
| Compare Modified Z and IQR | Runs both outlier rules on one list and shows which values each rule flags | Requires a list of observations |
A list can hold up to 2,000 observations separated by commas, spaces, semicolons or new lines. Optional settings are the potential-outlier threshold, prefilled at 3.5 with 3, 4 and 5 as alternatives, and the number of decimal places. The IQR functions add a quartile method, R-7 linear interpolation or Tukey hinges, and a fence multiplier of 1.5 or 3. The list functions also show a table with each observation, its modified Z score and its IQR flag.
Modified Z Score Formulas
(x − x̃) ÷ MAD [1]
| M | Modified Z score of the observation |
| x | The observation |
| x̃ | Median of the data |
| MAD | Median absolute deviation: the median of |x − x̃| over all the data [2] |
Iglewicz and Hoaglin recommend labeling a value as a potential outlier when its modified Z score has an absolute value greater than 3.5 [1]. An ordinary Z score, built on the mean and standard deviation, can mislead in a small sample, because the largest score any value can reach is (n − 1) ÷ √n [1]. With 10 values that cap is 2.85, so a cutoff of 3 can never be reached. The MAD is much less affected by values in the tails [2].
Modified Z scores from data
The calculator sorts the list, takes the median, takes the median of the absolute distances from it as the MAD, and applies the main formula to every value. For 2, 3, 3, 4, 4, 5, 5, 6 and 30 the median is 4 and the distances are 2, 1, 1, 0, 0, 1, 1, 2 and 26, whose median is 1. The value 30 scores 0.6745 × 26 ÷ 1 = 17.54 and is the only one flagged. The result also lists MAD ÷ 0.6745 as a robust estimate of the standard deviation, 1.4826 here.
When more than half the values are identical the MAD is zero, the score cannot be computed and the calculator says so. The IQR functions still work in that case.
Modified Z score
The main formula applies directly to an observation with a known median and MAD. For an observation of 10, a median of 5 and a MAD of 2, M = 0.6745 × (10 − 5) ÷ 2 = 1.686, which is not flagged at the 3.5 threshold. The result also gives a normal-reference two-tail area, the share of a standard normal curve farther from zero than the score, which is 0.0917 here.
Observation from score
With a median of 5 and a MAD of 2, a score of 3.5 belongs to the observation 5 + 3.5 × 2 ÷ 0.6745 = 15.378.
Median from score
An observation of 10 with a score of 1.68625 and a MAD of 2 implies a median of 10 − 1.68625 × 2 ÷ 0.6745 = 5.
MAD from score
An observation of 10, a median of 5 and a score of 1.68625 imply a MAD of 0.6745 × 5 ÷ 1.68625 = 2. A score of zero has no answer here, because any MAD gives zero when the observation equals the median.
Modified Z decision bounds
t is the threshold. With a median of 5, a MAD of 2 and t = 3.5, values from −5.378 to 15.378 are not flagged. A value exactly on a bound has a score equal to the threshold and is not flagged either, because the rule is strictly greater than.
IQR outliers from data
High = Q3 + k × IQR [3]
IQR = Q3 − Q1, the interquartile range. With k = 1.5 these are the inner fences and a point beyond one is a mild outlier. With k = 3 they are the outer fences and a point beyond one is an extreme outlier [3]. For the nine values above, Q1 = 3 and Q3 = 5, so the inner fences are 0 and 8 and only 30 is flagged.
The two quartile methods can give different fences. R-7 places a quartile at position (n − 1) × p along the sorted list and interpolates between neighbors, which is the default method in R [4]. Tukey hinges are the lower and upper hinges of Tukey’s five-number summary [5], taken here as the medians of the lower and upper halves of the data, with the middle value counted in both halves when n is odd. For 1, 2, 3, 4, 5, 6, 7 and 20, R-7 gives quartiles of 2.75 and 6.25 and Tukey hinges give 2.5 and 6.5.
Compare Modified Z and IQR
This function applies both rules to one list and reports a count for each, then lists the values flagged by both, by modified Z only and by IQR only. The rules often disagree near the edges, because one measures distance from the median in MAD units and the other from the quartiles in IQR units.
Limits of This Estimate
- A flag marks a value to look into, not one to delete. An outlier may be random variation or something of real interest, and it should be removed only when it is found to be an error [1].
- The 3.5 threshold is a recommendation, not a test with a fixed error rate. The normal-reference area is not a calibrated p-value, because modified Z scores do not follow a normal distribution exactly.
- A MAD of zero makes the score undefined, which happens whenever more than half the data share one value.
- Quartiles have several definitions, so IQR fences from this calculator can differ slightly from other software.
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods, Section 1.3.5.17, Detection of Outliers: the modified Z score formula, the 3.5 cutoff of Iglewicz and Hoaglin and the advice on handling outliers
- NIST/SEMATECH e-Handbook of Statistical Methods, Section 1.3.5.6, Measures of Scale: the median absolute deviation and its resistance to extreme values
- NIST/SEMATECH e-Handbook of Statistical Methods, Section 7.1.6, What are outliers in the data?: inner and outer fences, mild and extreme outliers
- R Core Team, R documentation, Sample Quantiles (quantile): the type 7 quantile definition and its use as the default
- R Core Team, R documentation, Tukey Five-Number Summaries (fivenum): lower and upper hinges in Tukey’s five-number summary
