Hui Jeong(Hailyee) Ha

Human Mobility, Transportation & Spatial Data Science

All Geocomputation lectures

Lecture 1 · Descriptive statistics

Three tumblers, one average

Yeti, Owala and Stanley each averaged 14 sales a day. We’ll use their five-day totals to see why spread matters.

From the lecture slides

Same average, very different weeks · Slide 60
Same average, very different weeks · Slide 60
The coffee example: population and sample · Slide 38
The coffee example: population and sample · Slide 38
The reference: professional footballers · Slide 75
The reference: professional footballers · Slide 75

Hi everyone! There’s a lot to take in during the first week of R. Let’s start with the tumbler sales before we look at any code. Yeti, Owala and Stanley each sold 14 a day on average. Have a look at the five days and tell me which brand you’d find easiest to keep in stock.

Read the numbers for each brand

Yeti’s sales stayed close to 14 and its standard deviation is 1. Stanley’s sales went up and down more and its standard deviation is about 6.32. Look at how far each day is from 14. You can see where the bigger standard deviation comes from.

Think about what goes in the denominator

In class we pictured all the coffee orders in London and the 50 cups we actually measured. That’s our population and sample. Then we switched to football. If two players spend different amounts of time on the pitch, compare goals per 90 minutes. A z-score tells us how far a value is from its group’s average, in standard deviations.

In R

Each row holds one brand’s five weekday counts from the lecture.

sales <- rbind(Yeti    = c(13, 13, 14, 15, 15),
               Owala   = c(10, 12, 14, 16, 18),
               Stanley = c(6, 10, 14, 18, 22))
rowMeans(sales)
apply(sales, 1, sd)

Read the row means with the row standard deviations. Identical means can sit beside very different spreads.

Key takeaways

  • Give the mean or median and say how spread out the values are.
  • Say what you divided by when reporting a rate, and who you compared with when reporting a z-score.