MD9, MD13, MD14 - Outliers, missing values and data cleaning
Apply MEI's inclusive outlier rules and make cleaning decisions that respect missing values, genuine extremes and paired observations. You will use current LDS9 measurements and choose displays whose scales and time order support a fair conclusion.
MEI outlier boundaries include equality
Should a measurement exactly on an outlier boundary be investigated? For MEI, yes: the definitions say at least the stated distance. The small word “least” changes a boundary decision, even when every calculation is correct.
Consider a mass of kg in data with quartiles and kg. It lies exactly kg above the upper quartile, which is times the IQR. It meets MEI's rule.
You already know
The IQR is . MEI sample SD uses squared-deviation divisor . When a question supplies the summaries, use them as given rather than adding a candidate observation and recalculating them.
A numerical threshold is one way to identify inconsistency. A plotted relationship may reveal another.
Outlier
An outlier is an item inconsistent with the rest of the data. In a scatter diagram this can be a pair far from the relationship, even when neither coordinate is extreme on its own. A large coordinate that follows the pattern is not automatically an outlier.
MEI permits the term for values at least two SDs from the mean, or at least beyond the nearer quartile.
MEI inclusive outlier rules
Using , the quartile rule is
The standard-deviation rule is
Equality is included. The quartile rule concerns the tails beyond the quartiles, not the region between them.
Not in the formula sheet: learn it.
Use enough precision to settle a near-boundary value. Rounded summaries may be insufficient to decide whether a point is exactly on the theoretical boundary.
Worked example 1: include the fence
Question. A mass dataset has , , mean and sample SD , all in kg. Use each rule separately to classify kg and kg.
Plan. Calculate the two sets of boundaries and include equality.
Why include and ? Each is exactly the required distance from its relevant reference point, so each satisfies “at least”.
Answer. The IQR rule flags kg only. The SD rule flags both kg and kg.
Check. , and .
Change only the second candidate, from to . Moving just inside a fence can change one rule's conclusion while leaving the other unchanged.
Worked example 2: move inside one boundary
Question. With the same summaries , , mean , sample SD kg, classify kg and kg using each rule.
Plan. Retain the boundaries and compare each candidate with the relevant outer regions.
Why can the rules disagree? Quartiles and mean/SD summarise different features of the same distribution; they are alternative definitions, not guaranteed equivalent tests.
Answer. Neither candidate is flagged by the IQR rule. Both are flagged by the SD rule.
Check. The changed mass remains well above the upper SD boundary , despite dropping below the IQR fence .
In a box plot, check whether whiskers show extrema or the furthest non-outliers. When asked where actual outliers lie, intersect the theoretical outlier regions with the values shown: a possible lower-tail region can contain no observations. A genuine unusual member of the population may be worth keeping, so an outlier flag is not a deletion instruction.
Watch out
Wrong: “Use the median plus or minus .” Right: move outwards from the nearer quartile, or , and include the boundary for MEI.
Apply both definitions to another dataset.
Cleaning decisions depend on the analysis
A useful cleaning decision starts with the variables you need. Deleting every row with any missing cell may throw away perfectly good measurements.
Data cleaning
Data cleaning deals with missing values, errors, inconsistent formats and possible outliers using source evidence and the intended analysis. Preserve the source, work on a copy, and record corrections, exclusions and the valid count.
Check the observational unit, units, category codes and identifiers. Repeated values from different people are not duplicates. Correct an error if its true value is known; otherwise mark the affected value missing for relevant calculations. A genuine extreme observation remains part of the data unless a stated, defensible selection rule excludes it.
The current MEI LDS9 contains people aged or over from the US NHANES – survey. Its missing code is “#N/A”, deliberately chosen to prevent software reading a blank as zero. The following are the first five people in the workbook's data sheet. Row labels identify positions, not new survey identifiers.
| Data-sheet row | Age, years | Pulse, beats per minute |
|---|---|---|
| #N/A | ||
Worked example 3: select for a pulse calculation
Question. From the five-row LDS9 extract above, find the observed mean pulse and the number of usable age–pulse pairs. Give the mean to significant figures.
Plan. Filter on pulse availability, keeping each remaining person's age and pulse together.
Why exclude the whole pair for the scatter diagram? Keeping age and sliding another person's pulse into that row would create a false pair.
Answer. Observed mean pulse beats per minute; four complete age–pulse pairs, from rows .
Check. The mean is between the smallest and largest observed pulses, and .
Change only the mean being requested: use age rather than pulse. The source rows remain exactly the same.
Worked example 4: keep a valid value in another analysis
Question. From the same five-row extract, find the mean age and the number of usable age–pulse pairs. Give the mean age to significant figures.
Plan. Use every observed age for the one-variable mean, but still require both fields for a pair.
Why does the valid count depend on the calculation? Missing pulse does not erase a known age. A mean age needs one field; an age–pulse plot needs two in the same row.
Answer. Mean age years for these five people; four complete age–pulse pairs.
Check. Excluding row unnecessarily would give years, a different mean for a different subset.
Document unit conversions too. Masses kg, g, missing and kg give three observed masses with mean kg and sample SD kg. Entering a zero for missingness invents a fourth measurement. Even careful omission can leave bias if missing observations differ systematically from the observed ones.
Continue this lesson.
You’re previewing NovaLearn without an account. Create a free account to read the rest.
Create free account