OpenCyber Academy
Bachelor's · Chapter 7 · English
Course code: OCA-095Chapter 07: OCA-095-C007

Chapter 7 — Statistics for data work

Open, free learning for anyone who wants to protect people and technology. No account is required to read this text or its worked answers.

Lesson map

Lesson 07 published. Map, example, EX019.

flowchart TD
  N0["Learning outcomes"]
  N1["7.1 Summaries"]
  N2["7.2 Samples"]
  N3["7.3 Uncertainty"]
  N4["7.4 Misreadings"]
  N0 --> N1 --> N2 --> N3 --> N4
  N4 --> EX["Worked example"]
  EX --> Q["Exercise EX019"]

Logical drawing

flowchart LR
  N0["Learning outcomes"]
  N1["7.1 Summaries"]
  N2["7.2 Samples"]
  N3["7.3 Uncertainty"]
  N4["7.4 Misreadings"]
  N0 --> N1 --> N2 --> N3 --> N4 --> Q["EX019"]
[Learning outcomes]
    |
    v
[7.1 Summaries]
    |
    v
[7.2 Samples]
    |
    v
[7.3 Uncertainty]
    |
    v
[7.4 Misreadings]
    |
    v
[Worked example] --> [Exercise EX019]

Learning outcomes

You will (1) summarise data with simple statistics; (2) use samples to estimate quality; (3) avoid common misreadings.

7.1 Summaries

Amara summarises synthetic basket values using Python's statistics module: mean, median and standard deviation. The mean basket is higher than the median because a few large orders pull it up. She explains that the median better describes a typical basket, while the mean matters for total revenue. Choosing the right summary depends on the question. She notes that reports at Harbourline used only means, which made typical customers appear to spend more than they actually do. Amara adds medians to the reports she prepares.

7.2 Samples

Checking every record by hand is impossible. Amara learns to draw a random sample of records, check each carefully and estimate the error rate for the whole set. Using Python's random module with a fixed seed, she samples two hundred member addresses and finds a number with errors. She explains that a random sample gives a fair estimate, while picking records that look suspicious overstates problems because those records are not typical of the whole set. She records the seed so the sample can be drawn again.

7.3 Uncertainty

A sample estimate has uncertainty. Amara learns that larger samples give narrower ranges, and that reporting a range is more honest than a single figure. She explains to a classmate that an error rate of four percent from two hundred records could plausibly be a little lower or higher in the full set. Dr. Lindqvist encourages her to always state sample size with any estimate so readers can judge its reliability for themselves. Amara adds sample sizes to every estimate in her journal.

7.4 Misreadings

Amara collects common misreadings: confusing percentages with percentage points, comparing groups of very different sizes, treating correlation as cause and ignoring missing data. At Harbourline, a report claimed that loyalty members spend more because of the scheme, but members may simply be regular shoppers who joined. She notes that governance includes making sure reports are interpreted correctly, not only that their numbers are computed correctly from accurate data. Amara writes a short note on each misreading for the data team, with examples taken from Harbourline's own reports.

Worked example

Amara compares mean and median baskets, estimates address errors from a random sample, reports ranges with sample size and lists misreadings such as treating loyalty correlation as cause.

Synthetic case. Data are synthetic.

Errors and limits

Hand-picked samples overstate problems; sample randomly.

Exercises

Worked answers

EX019. The median.

EX020. They overstate the error rate.

EX021. Members may be regular shoppers who joined, not changed by the scheme.