L4 - Outliers, missing values and data choices
Investigate possible outliers, distinguish missing values from genuine zeros and choose displays that support a fair conclusion. Use the actual AQA car data to make field-specific cleaning decisions and keep an honest account of what remains uncertain.
Identifying and investigating outliers
Should you delete a car record because its engine size is zero? For an electric car, that zero can make sense; for its mass, zero cannot. A surprising entry needs investigation before a decision, and the decision depends on the variable.
You already know
The interquartile range is . Mean and standard deviation use all observations, while median and IQR are less sensitive to a single distant value. None of these summaries tells you whether an entry is genuine.
An outlier is an observation unusually far from the rest or from the pattern in a diagram. It can be a genuine unusual case, an error or evidence of another population group. A point isolated vertically from a scatter pattern may matter even if neither coordinate is extreme on its own.
Apply the rule stated in a question, including whether the boundary is strict. A common supplied rule flags values below or above . This rule is not in the formula booklet, and it is not a universal definition to impose when a different rule is supplied.
Worked example 1: apply a strict fence
Question. Illustrative measurements have , . A rule flags values strictly below or strictly above . Decide which of are flagged.
Plan. Calculate both fences, then compare each observation with them.
Why this step? The quartile rule identifies possible outliers; it does not establish that they are errors.
Answer. Only is flagged, since ; none of the values is below .
Check. , the next largest value, is inside the fences.
Change only the final value from to , leaving the supplied quartiles and rule fixed. The boundary word now decides the result.
Worked example 2: an observation on the fence
Question. Using the same supplied quartiles and strict rule, decide which of are flagged.
Plan. Retain the fences and test the final observation against the strict inequality.
Why this step? Replacing “above” by “at least” would change the stated rule.
Answer. None is flagged. This does not prove every observation is free of error; it only gives the outcome under this rule.
Check. All five observations lie in the closed interval .
To investigate a flagged entry, check its source, units, recording equipment and population membership. Correct it only if reliable evidence supplies the correction. Otherwise preserve the raw entry and explain any analysis with and without it.
For illustrative waits minutes, including gives mean , median and descriptive standard deviation minutes. Omitting it gives mean , median and standard deviation minutes. The large changes show sensitivity, not permission to discard a valid long wait. For other datasets, examine the effect rather than claiming removal must change every statistic in a particular direction.
Watch out
Wrong: “ is outside the fence, so delete it.” A fence flags a case; it does not diagnose an error. Right: investigate, preserve the raw value and justify any correction or exclusion.
The next question changes the quartiles and includes an equality case as well as a flagged case.
Cleaning each field honestly
A missing entry says that a measurement is not recorded; a numerical zero records a value, whose meaning depends on the field.
Keep the source sheet and create a separate analysis view. Log the variable, proposed checks, exclusions or reliable corrections, and resulting count. Do not apply one field's exclusions automatically to every other field in a row.
The following four selected entries are authentic AQA records. The dash represents a blank NOX cell, not a numerical code. EngineSize is in , Mass in , and emissions in .
| ReferenceNumber | Fuel | EngineSize | Mass | CO2 | NOX |
|---|---|---|---|---|---|
| Petrol | |||||
| Petrol | — | ||||
| Electric | — | ||||
| Petrol |
Source: AQA car LDS, DfT Stock Vehicle Database, Open Government Licence v3.0. Mass includes for an average driver. Decimal emissions retain their recorded precision.
Worked example 3: a mass-specific filter
Question. Find the mean of the usable masses in this selected extract, assuming reliable corrections are unavailable. Explain the exclusions.
Plan. Reject impossible zero masses for this analysis, then use the positive-mass count as the denominator.
Why this step? A recorded car mass of zero is impossible, whereas an electric car can have a meaningful zero combustion-engine capacity.
Answer. The usable-mass mean is . Exclude the mass entries for and , retain the original rows and log the decision. Keep electric record 's positive mass.
Check. Including the two zero masses would give , halving this mean by treating unusable entries as genuine masses.
Change only the analysis field from Mass to NOX; retain the same four records. This changes which entries are available, rather than deleting entire rows.
Worked example 4: an emissions-specific filter
Question. Find the mean recorded NOX in the same selected extract. Explain how the two blanks enter the calculation.
Plan. Use the two observed NOX values and count only those observed measurements.
Why this step? Record 's unusable mass says nothing about whether its observed NOX is usable.
Answer. Mean recorded NOX . Leave the two blanks missing and exclude them only from this NOX calculation; do not replace them with zero.
Check. Filling blanks with zero would instead give , inventing two measurements.
The full workbook has rows, with zero masses and blank NOX cells. A positive-Mass analysis therefore uses entries; a recorded-NOX analysis uses , before any further justified restrictions. Check these counts in software before calculating summaries. Availability can vary by vehicle type or year, so the observed subset need not represent the missing subset without bias.
Zero EngineSize and recorded CO2 can be meaningful for an electric vehicle. Zero recorded CO2 does not establish zero environmental impact over the car's life. The workbook defines particulate emissions for diesel; a blank for another fuel type can be not applicable rather than an unmeasured diesel value. The source field notes give availability percentages for the whole underlying database; do not substitute those for counts measured in this selected workbook.
Continue this lesson.
You’re previewing NovaLearn without an account. Create a free account to read the rest.
Create free account