StatisticsExploring One-Variable Data1 of 8
Exploring One-Variable Data · 1

Data, Variables, and Distributions

Our memory blurs a lot of separate observations into a vague gut feeling, so we need an organized way to write them down.

1

Individuals, Variables, and Data

Data is a table that organizes observations by giving each person or object we study its own row and each question we ask about them its own column.

Individuals, Variables, and Data

One row of the coffee shop table links a single customer to the three answers recorded for them:

Customer 1⏟individual (or case):Latte⏟Drink Type,2 shots⏟Espresso Shots,3.2 min⏟Wait Time⟶one row of data⏟all rows and columns\displaystyle \underbrace{\text{Customer 1}}_{\text{individual (or case)}} : \quad \underbrace{\text{Latte}}_{\text{Drink Type}}, \quad \underbrace{2\text{ shots}}_{\text{Espresso Shots}}, \quad \underbrace{3.2\text{ min}}_{\text{Wait Time}} \longrightarrow \quad \text{one row of }\underbrace{\text{data}}_{\text{all rows and columns}}
2

Categorical and Numerical Variables

Once our observations are in columns, we want to summarize them with math. That means separating columns that sort individuals into labels from columns that record real numbers.

Variables split into categorical variables, which sort individuals into categories or labels, and numerical (or quantitative) variables, which record numbers where arithmetic makes sense.

Categorical and Numerical Variables
Customer 1\text{Customer 1}
Customer 2\text{Customer 2}
Customer 3\text{Customer 3}
Customer 100\text{Customer 100}
drinktype\begin{gathered}\text{drink}\\[-3pt]\text{type}\end{gathered}
Latte\text{Latte}
Cold Brew\text{Cold Brew}
Matcha\text{Matcha}
Drip Coffee\text{Drip Coffee}
espressoshots\begin{gathered}\text{espresso}\\[-3pt]\text{shots}\end{gathered}
22
11
00
33
waittime\begin{gathered}\text{wait}\\[-3pt]\text{time}\end{gathered}
3.2 min3.2\text{ min}
1.8 min1.8\text{ min}
3.5 min3.5\text{ min}
2.6 min2.6\text{ min}
variables\text{variables}

Even when a cash register records drink types with number codes, averaging those codes gives a meaningless number, whereas averaging wait times gives an actual time:

1 (Latte)+2 (Cold Brew)2=1.5⏟meaningless → categorical2 min+4 min2=3 min⏟meaningful arithmetic → numerical\displaystyle \begin{aligned}&\underbrace{\frac{\categorical{1\text{ (Latte)}} + \categorical{2\text{ (Cold Brew)}}}{2} = \meaningless{1.5}}_{\text{meaningless }\rightarrow\categorical{\text{ categorical}}} \\[2.6em] &\underbrace{\frac{\numerical{2}\text{ min} + \numerical{4}\text{ min}}{2} = \average{3}\text{ min}}_{\text{meaningful arithmetic }\rightarrow\numerical{\text{ numerical}}}\end{aligned}

A numerical variable is either counted in separate steps with gaps in between, or measured along a continuous range without gaps:

Counted things jump from one number to the next with empty space in between, while measured things fill every gap no matter how far you zoom in.

Whether a numerical variable is discrete or continuous depends on the values a single individual can have, not on the average across the whole table, so a discrete count can still have a decimal average:

0,1,2,3,4 shots⏟one customer (discrete count)⟶1.8 shots⏟average across 100 customers\displaystyle \underbrace{\numerical{0, 1, 2, 3, 4}\text{ shots}}_{\text{one customer (}\numerical{\text{discrete count}}\text{)}} \quad \longrightarrow \quad \underbrace{\average{1.8}\text{ shots}}_{\text{average across 100 customers}}
3

Identifying Individuals and Variables

In practice, observations start as a written description rather than a neat table, so we have to figure out what goes in the rows and classify each column ourselves.

From the shelter records for 8080 adopted dogs, which list each dog's breed, microchip ID number, days spent at the shelter, and weight in pounds, we want to identify the individuals and classify all four variables.

Identifying Individuals and Variables
A local animal shelter wants to understand\text{A local animal shelter wants to understand}
its adoptions better. They pull the records\text{its adoptions better. They pull the records}
for the 80 dogs adopted last month. For\text{for the 80 dogs adopted last month. For}
each dog, they write down the breed, the\text{each dog, they write down the breed, the}
microchip ID number, the number of days\text{microchip ID number, the number of days}
the dog spent at the shelter before\text{the dog spent at the shelter before}
being adopted, and the dog’s exact weight\text{being adopted, and the dog’s exact weight}
in pounds.\text{in pounds.}
Text solution
Find who the measurements describeBreed, microchip ID, days at the shelter, and weight all measure the dogs rather than the owners or shelter workers, so each adopted dog gets its own row.
Rows: Dog 1, Dog 2, …, Dog 80⏟80 individuals (cases)\displaystyle \text{Rows: }\underbrace{\text{Dog 1, Dog 2, }\dots\text{, Dog 80}}_{\text{80 individuals (cases)}}
Test the word and digit labels for arithmeticBreed sorts dogs by word labels, and averaging two microchip IDs tells us nothing about a typical dog, so both columns are categorical labels.
Golden Retriever, Beagle⏟Breed → categorical9851120045+98511200892⏟meaningless → Microchip ID is categorical\displaystyle \begin{aligned}&\underbrace{\categorical{\text{Golden Retriever, Beagle}}}_{\text{Breed }\rightarrow\categorical{\text{ categorical}}} \\[2.6em] &\underbrace{\frac{\categorical{9851120045} + \categorical{9851120089}}{2}}_{\text{meaningless }\rightarrow\text{ Microchip ID is }\categorical{\text{categorical}}}\end{aligned}
Separate the counted numbers from the measured numbersArithmetic makes sense for both shelter stay and weight (10 days=2×5 days\numerical{10}\text{ days} = 2 \times \numerical{5}\text{ days} and 40 lb=2×20 lb\numerical{40}\text{ lb} = 2 \times \numerical{20}\text{ lb}), with calendar days counted in whole steps and weight measured at any value on the scale.
1,2,…,14 days⏟counted with gaps → discrete numerical20 lb,20.4 lb,20.418 lb⏟measured without gaps → continuous numerical\displaystyle \begin{aligned}&\underbrace{\numerical{1, 2, \dots, 14}\text{ days}}_{\text{counted with gaps }\rightarrow\numerical{\text{ discrete numerical}}} \\[2.6em] &\underbrace{\numerical{20}\text{ lb}, \numerical{20.4}\text{ lb}, \numerical{20.418}\text{ lb}}_{\text{measured without gaps }\rightarrow\numerical{\text{ continuous numerical}}}\end{aligned}

So the shelter table has 8080 dog rows and four variable columns: two categorical (Breed and Microchip ID), one discrete numerical (Days at the Shelter), and one continuous numerical (Weight in Pounds).

4

Distributions

Even after we organize 100100 customers into a clean table, looking down a raw column of 100100 entries still tells us almost nothing at a glance. We need to turn the column into a picture of how its values are spread out.

A variable's distribution is what categories or values show up in the data and how often each one happens.

Distributions
Customer 1\text{Customer 1}
Customer 2\text{Customer 2}
Customer 3\text{Customer 3}
Customer 100\text{Customer 100}
drink type\text{drink type}
Latte\htmlClass{lc-green}{\text{Latte}}
Cold Brew\htmlClass{lc-green}{\text{Cold Brew}}
Matcha\htmlClass{lc-green}{\text{Matcha}}
Drip Coffee\htmlClass{lc-green}{\text{Drip Coffee}}
wait time\text{wait time}
3.2 min\htmlClass{lc-blue}{3.2}\text{ min}
1.8 min\htmlClass{lc-blue}{1.8}\text{ min}
3.5 min\htmlClass{lc-blue}{3.5}\text{ min}
2.6 min\htmlClass{lc-blue}{2.6}\text{ min}

Each customer row in the table adds one wooden block to the stack for its drink category or its 11-minute wait-time interval, turning a column of 100100 individual records into the variable's distribution.

Stacking each customer's entry by its category or value turns a long column of 100 rows into a clear shape that shows the variable's distribution.

How we display and summarize a distribution depends on whether the stacks sit above category labels or along a number line.

1010
2020
3030
4040
customers\text{customers}
Latte\htmlClass{lc-green}{\text{Latte}}
ColdBrew\htmlClass{lc-green}{\begin{gathered}\text{Cold}\\[-3pt]\text{Brew}\end{gathered}}
Matcha\htmlClass{lc-green}{\text{Matcha}}
DripCoffee\htmlClass{lc-green}{\begin{gathered}\text{Drip}\\[-3pt]\text{Coffee}\end{gathered}}
38\htmlClass{lc-green}{38}
31\htmlClass{lc-green}{31}
7\htmlClass{lc-green}{7}
24\htmlClass{lc-green}{24}
Drink Type\text{Drink Type}
1010
2020
3030
4040
customers\text{customers}
00
11
22
33
44
55
66
77
88
99
1010
long tail\text{long tail}
symmetrical\text{symmetrical}
center\htmlClass{lc-violet}{\text{center}}
spread\htmlClass{lc-pink}{\text{spread}}
Wait Time (minutes)\text{Wait Time (minutes)}
Categorical distribution⏟Drink Type (100 blocks)⟶count or percentagein each category⏟frequency table or bar chartNumerical distribution⏟Wait Time (100 blocks)⟶shape (symmetrical or tailed),center, and spread⏟histogram on a number line\displaystyle \begin{aligned}&\underbrace{\categorical{\text{Categorical}}\text{ distribution}}_{\text{Drink Type (100 blocks)}} \\[2.1em] &\quad \longrightarrow \quad \underbrace{\begin{gathered}\categorical{\text{count or percentage}} \\ \text{in each category}\end{gathered}}_{\text{frequency table or bar chart}} \\[3.6em] &\underbrace{\numerical{\text{Numerical}}\text{ distribution}}_{\text{Wait Time (100 blocks)}} \\[2.1em] &\quad \longrightarrow \quad \underbrace{\begin{gathered}\text{shape (symmetrical or tailed),} \\ \average{\text{center}}\text{, and }\spread{\text{spread}}\end{gathered}}_{\text{histogram on a number line}}\end{aligned}

Key concepts

Everything starts by turning observations into a table where each row is an individual (or case) and each column is a variable. To find the individuals in a problem, ask who or what the recorded columns actually measure (`Dog 1` to `Dog 80`, not the shelter workers).

To classify a variable, test whether averaging two entries makes sense before trusting how the entries are written:

Key concept

If averaging is meaningless, the variable is categorical, even when written with digits (`1 = Latte` or Microchip ID `9851120045`). Summarize its distribution by counting individuals or finding percentages in a frequency table or bar chart. Never report a numerical center or tail for categories.

Key concept

If averaging makes sense, the variable is numerical (or quantitative). Look at what a single individual can have, not the group average: separate counted steps with gaps (`0, 1, 2` espresso shots) make it discrete, even if the average across customers has a decimal (`1.8` shots), while measured values without gaps (`3.2` minutes or `20.418` pounds) make it continuous. Stack a numerical variable along a number line to form a histogram and describe its shape (symmetrical or stretched into a long tail), center, and spread.

5

Practice

1

Four mechanics inspect the 150150 buses in a city transit fleet. For each bus, they record the manufacturer (such as Gillig, New Flyer, or Nova), the number of seats inside the bus, and the total mileage on the odometer in miles. If you organize this data into a table, what are the individuals (and why aren't the mechanics the individuals), and is each variable categorical, discrete numerical, or continuous numerical?

Ask who or what the three measurements (manufacturer, seats, and mileage) actually describe: a mechanic or a bus?

IndividualsWatch out for the common mistake of picking the 44 mechanics just because they are the people in the problem. That would give a 44-row table, when manufacturer, seat count, and mileage are measurements of the buses. Each bus gets its own row, so the individuals are the 150150 buses.
ManufacturerSorts buses into word labels where arithmetic makes no sense →\rightarrow categorical.
Number of seatsArithmetic makes sense, and seats in a single bus are counted in whole numbers with gaps between possible values →\rightarrow discrete numerical.
Total mileageArithmetic makes sense, and distance is measured along a range without gaps (even if an odometer rounds what it displays, actual distance driven has no gaps) →\rightarrow continuous numerical.
2

An online store records three variables for each of 200200 shipped orders: the 55-digit destination ZIP code, the shipping speed code entered in the computer (11 for Standard, 22 for Express, 33 for Overnight), and the number of days the package took to arrive (counted in whole calendar days). Classify each variable as categorical, discrete numerical, or continuous numerical, and explain why being written with digits does not make all three numerical.

Try averaging two ZIP codes or averaging shipping codes 11 and 22. Does the result give a meaningful shipping measurement?

ClassificationDo not treat all three columns as discrete numerical just because all three are written with whole-number digits. Averaging two ZIP codes or averaging 1\categorical{1} (Standard) and 2\categorical{2} (Express) to get 1.5\meaningless{1.5} tells you nothing, so destination ZIP code and shipping speed code are just category labels →\rightarrow categorical.
For number of days to arrive, arithmetic makes sense (4\numerical{4} days is twice as long as 2\numerical{2} days). Avoid calling it continuous just because it involves time: here the store counts whole calendar days with gaps between values, so it is discrete numerical.
3

A librarian records the number of books checked out by each of 5050 visitors and finds that the average is 2.342.34 books per visitor. A student argues, "Because 2.342.34 has a decimal, the number of books checked out must be a continuous variable." Explain why the student is mistaken.

Ask how many books a single visitor can check out at the desk, before anyone divides by 5050 to find the average.

The student is confusing the average across 5050 visitors with the values a single individual can have. One visitor can only check out a whole number of books (0,1,2,3,…\numerical{0, 1, 2, 3, \dots}, never 2.34\meaningless{2.34} books for one person). Because a single visitor's count has gaps between possible values, number of books checked out is discrete numerical; dividing a whole-number total by 5050 visitors can still give a decimal average of 2.34\average{2.34}.
4

A bakery records the pastry ordered (Croissant, Muffin, or Scone) and the wait time in minutes for each of 8080 morning customers, then stacks one wooden block per customer to show the distribution of each variable. How many total blocks are in each distribution, where do two customers with wait times of 2.1\numerical{2.1} minutes and 2.8\numerical{2.8} minutes land on a number line marked in 11-minute intervals, and what two things does a variable's distribution tell you?

Each customer row in the table drops one block into the variable's picture. Check which 11-minute interval on the number line contains both 2.1\numerical{2.1} and 2.8\numerical{2.8}.

Total blocksAvoid multiplying 80×2=16080 \times 2 = \meaningless{160} blocks or counting 3\meaningless{3} blocks for the 33 pastry types. Each of the 8080 customer rows adds one block per variable, so each distribution contains 8080 blocks.
Where 2.1\numerical{2.1} and 2.8\numerical{2.8} minutes landOn a number line marked in 11-minute intervals, both 2.1\numerical{2.1} minutes and 2.8\numerical{2.8} minutes fall between 22 and 33, so both blocks land stacked on top of each other in the 22-to-33 minute interval.
What the distribution tells youIt shows what categories or values show up, and how often each one happens.
5

A theater collects data on 500500 ticket sales, recording the movie genre (coded as 1=Action1 = \text{Action}, 2=Comedy2 = \text{Comedy}, 3=Drama3 = \text{Drama}, 4=Horror4 = \text{Horror}) and the ticket price paid in dollars. An intern writes: "The distribution of movie genre has a center of 2.12.1 and a long tail stretched to one side, just like the distribution of ticket prices." Explain what is wrong with the intern's description of movie genre, and state how each distribution should be summarized and displayed instead.

Check whether movie genres 1,2,3,41, 2, 3, 4 sit on a real number line where 2.12.1 is a meaningful middle genre.

What is wrongThe intern made the mistake of treating the digit codes 1,2,3,4\categorical{1, 2, 3, 4} as real numbers. Movie genre is categorical: its labels have no numerical order on a number line, so a "center of 2.1\meaningless{2.1}" and a "long tail" are meaningless (reordering the genre codes would completely change the shape and average).
How to summarize and display eachSummarize the categorical movie genre distribution by counting the ticket sales (or finding the percentage) in each genre and display it with a frequency table or bar chart; display the numerical ticket price distribution as a histogram on a number line and summarize it by its shape (symmetrical or tailed), center, and spread.