2.02h–2.02j - Outliers, missing values and data cleaning
Identify possible outliers with H240's precise boundary rules, clean missing or erroneous observations without changing their meaning, and choose displays that answer the statistical question. You will use the census large data set to distinguish a large count from a large proportion.
Outlier rules identify values to investigate
Can making a spreadsheet look tidier make its answer less truthful? Suppose a blank mass is replaced by zero, or an unusually large but genuine observation is deleted. Both changes make calculations easier; neither is justified just by appearance. First learn to flag values, then decide what the evidence allows you to do with them.
You already know
The interquartile range is . Standard deviation measures spread about the mean. Both describe the data; neither decides whether an observation was recorded correctly.
A conspicuous point may be meaningful, mistaken or part of a different group. Investigate its context before choosing an action.
Possible outlier
A possible outlier is an observation unusually far from the rest of the data or inconsistent with a visible relationship. In a scatter diagram, a moderate journey distance with an exceptionally long journey time can be inconsistent with the pattern, while a very long journey following the pattern need not be.
H240's two numerical rules use more than, so equality at a boundary is not flagged by that rule.
H240 outlier boundaries
The quartile rule flags
The standard-deviation rule flags
The quartile rule concerns values beyond the nearer outer quartile, not points between the quartiles.
Not in the formula sheet: learn it.
The rules need not agree: each uses different information. State which rule you applied, and retain enough precision to decide a case near a fence.
Worked example 1: equality is a boundary case
Question. Parcel masses have , , mean and SD , all in kg. Use each rule separately to classify kg and kg.
Plan. Calculate both pairs of boundaries, then use strict inequalities.
Why distinguish from ? H240's definitions say more than the stated distance, so the fence itself is excluded.
Answer. The IQR rule flags neither value: is on its fence. The SD rule flags , but not , which is on its boundary.
Check. , whereas .
Change only the second candidate, from to . A tiny numerical change matters when it crosses a boundary.
Worked example 2: cross a fence
Question. With the same summaries , , mean , SD kg, classify kg and kg using each rule.
Plan. Keep the existing boundaries and compare the changed observation with them.
Why retain the supplied summaries? This question compares specified candidates with a stated distribution; it does not ask you to add candidates to the data and recalculate the summaries.
Answer. Both rules flag kg. Neither flags kg.
Check. The second candidate moved outwards, so it cannot stop being flagged by the SD rule.
In a box plot, establish what the whiskers represent: they may show extrema or the furthest non-outlying observations. If a question asks for the outliers actually present, compare the theoretical fences with the displayed data range. A region that contains no observed values contributes no actual outliers.
Watch out
Wrong: “Anything more than from the median is an outlier.” Right: move outwards from and , then use the strict inequalities.
Try a new set of boundaries.
Cleaning preserves the meaning of observations
Cleaning makes data suitable for the intended investigation while preserving a record of what changed and why.
Data cleaning
Data cleaning identifies and deals with missing values, recording errors, inconsistent formats and possible outliers using the variable definitions and source evidence. An unusual genuine observation belonging to the target population is not automatically an error.
Keep the source unchanged and work on a copy. Establish the unit of observation, units, coding and target population. Check suspected duplicates by identifier: equal measurements from different people are not duplicates. Convert documented units, correct confirmed errors from reliable evidence, and mark an uncorrectable erroneous value as missing for the relevant analysis. Log exclusions and the count left.
Worked example 3: a blank is not a measurement
Question. Four mass records are kg, g, a blank, and kg. The blank means unrecorded. Calculate the observed mean in kg and state a defensible treatment of the blank.
Plan. Convert units, retain the three observed values, and report the count.
Why not use zero? Zero would invent a fourth mass, changing both the total's meaning and the divisor.
Answer. Observed mean kg, to significant figures, based on three records. Keep the blank missing and document its omission from this calculation.
Check. The mean lies between and kg. Coding the blank as zero would give kg, below every observed mass.
Change only the missing record: source evidence now recovers its true value as kg. This is a correction supported by evidence, rather than a guess.
Worked example 4: recover a confirmed measurement
Question. The same four records are kg, g, a recovered kg, and kg. Calculate the mean and describe the cleaning log.
Plan. Include the recovered observation and use the new valid count.
Why is this inclusion justified? A source record supplies the measurement. Replacing a blank by a convenient average would manufacture information.
Answer. Mean kg, to significant figures. Log the unit conversion, the recovered value and its evidence, and that all four observations are now used.
Check. The recovered value is just above the previous observed mean, so including it raises the mean slightly.
Continue this lesson.
You’re previewing NovaLearn without an account. Create a free account to read the rest.
Create free account