Skip to course content
Free R data course

R Foundations for Data Analysis

Unit 08.04: Where description ends and inference begins

You can now describe what happened. Whether it would happen again is a different question, and a different course.

Description ends where inference begins

Everything in this course describes the rows in front of you. The mean of these twelve readings, the rate in these wards, the difference between these two groups — all exactly true of this data, and all silent about anything beyond it.

Inference asks the next question: given the variation in the data, how much confidence does a difference of this size deserve? That requires ideas this course has not covered — sampling, variability, confidence intervals, hypothesis tests.

The R you have learned does not change. group_by(), summarise() and ggplot2 are the same tools; what changes is the question and the amount of care the answer needs.

This block shows exactly where the boundary falls.

suppressPackageStartupMessages(library(dplyr))

# What this course can answer, and where the next one starts.
ward <- data.frame(
  ward   = c(rep("North", 6), rep("South", 6)),
  visits = c(412, 455, 431, 402, 428, 440, 388, 401, 396, 410, 385, 399)
)

described <- ward |>
  group_by(ward) |>
  summarise(n = n(), mean = round(mean(visits), 1), sd = round(sd(visits), 1),
            .groups = "drop")
print(described)

difference <- round(described$mean[1] - described$mean[2], 1)
cat("\nThis course answers: North's mean is", difference, "visits higher.\n")
cat("That is a description of these 12 rows, and it is certainly true of them.\n\n")

cat("What it cannot answer:\n")
cat("  Would the gap appear again next quarter?\n")
cat("  Is", difference, "large relative to the month-to-month variation of",
    described$sd[1], "and", described$sd[2], "?\n")
cat("  How confident should anyone be that the difference is not noise?\n\n")
cat("Those three questions are inference, and they are the next course.\n")

North's mean is 31.5 visits higher than South's, over six readings each. That is a true statement about these twelve rows and this course can make it confidently. What it cannot say is whether the gap would appear again, or whether 31.5 is large relative to the month-to-month variation of 19 and 9.1 — a comparison that needs inference. Notice that the two wards' variability differs by a factor of two, which is exactly the kind of thing that decides whether a difference means anything.

The mistake this prevents

The mistake is treating a descriptive difference as an established effect. 'North is higher' is true of the data; 'North is busier' is a claim about the world that needs more than a mean.

Takeaway

Be precise about which claim you are making. Descriptive statements need no apology — they just need to be stated as descriptions. For anything beyond the rows in front of you, continue into basic statistics and statistics with R.