Can Humans Choose Randomly?

Nearly 1,000 students looked at this grid and were asked to pick three squares at random. Today we test whether they actually did.

The data

A CSV is a plain spreadsheet, like an Excel file. Each row is one student. A 1 marks a square they chose; a 0 marks one they did not. The first three rows of rand_data.csv look like this:

One Two Three Four Five Six Seven Eight Nine
1 0 0 0 1 0 0 0 1
1 1 0 0 1 0 0 0 0
0 1 0 0 1 0 0 1 0

So the first student chose squares 1, 5, and 9.

Part 1. Which squares were chosen most and least?

Click Run Code. The first click downloads R into your browser (a few seconds); after that it is quick.

Talk through these with a neighbor.

1. What does this figure tell you about how well humans sample randomly?

If every student had truly chosen at random, what would the nine bars look like?

Random choices would make all nine bars about the same height. They are not. The center square (5) was chosen almost three times as often as square 6, and the corners (1 and 9) are also tall. People are drawn to the middle and the corners and avoid the edges. Humans are poor random samplers.

2. Which triplet (set of three squares) do you think students chose most often?

Find the three tallest bars. Where do those squares sit on the grid?

1, 5, 9

3. What does each line of code do? Read it like a sentence.

The arrow <- means “store this under the name on the left.” A word followed by parentheses is a function: it does something to whatever is inside the parentheses.

  • d <- read.csv("rand_data.csv") opens the spreadsheet file and stores it under the object name d.
  • colSums(d) adds up each column, giving nine totals: how many students chose each square.
  • barplot(...) draws those nine totals as bars.

Part 2. Is 1-5-9 chosen more often than chance?

There are 84 different ways to pick three squares out of nine. If people chose at random, every one of those 84 triplets would be equally likely.

First, work out how often 1-5-9 should appear by chance. R is a calculator: type the math and run it.

4. If choices were random, what fraction of students would pick 1-5-9? Write it as a decimal.

One triplet out of 84 equally likely possibilities. That is a division problem.

1 / 84 is about 0.012. Roughly 1 student in 100 would land on 1-5-9 by chance.

Now find how often students actually picked 1-5-9. This block uses d from Part 1, so run that block first.

5. Compare the two numbers. How many times more often did people choose 1-5-9 than chance predicts?

Divide the number you just computed by the chance value from question 4.

About 0.24 of students chose 1-5-9, compared with 0.012 expected by chance. That is roughly 20 times more often.

6. Hypothesis: people do not choose their three squares at random. Do the data support it?

Could a gap this large, across nearly 1,000 students, happen by luck?

Yes, strongly. Chance predicts 1-5-9 about 1% of the time; it appeared 24% of the time. With this many students, a gap that large is not luck. Humans have patterns even when they try not to, which is why real studies let a computer do the randomizing.

7. What does each line of code do? You do not need to know R. Reason it out.

c() combines values into a list. == asks “are these equal?” and answers TRUE or FALSE. Adding up TRUEs counts them. nrow() counts rows.

  • target <- c(1,0,0,0,1,0,0,0,1) stores the 1-5-9 pattern as nine 0s and 1s, named target.
  • match <- rowSums(d == target[col(d)]) == 9 compares every student’s row to target, square by square. A row matches only when all nine squares agree, so each student gets a TRUE or FALSE. (The target[col(d)] part lines the pattern up against every row.)
  • sum(match) / nrow(d) counts the TRUEs and divides by the number of students: the fraction who chose 1-5-9.

Try it

Want a truly random triplet? Let R pick one. Run this a few times.