The hot hand is a term used in basketball to describe a player making a series of successful throws at the basket, i.e., getting “hot”. But it seems that we, as humans, are too fast at jumping at the conclusion that someone is “hot” just because we saw some impressive streak of successes in a series of trials.

This is related to the following game I regularly play in my introductory statistics classes, geared at answering how long a run of consecutive successes should be in order to make us suspicious that something “hot” is going on. I tell my students that after I leave the classroom (a dangerous thing to do, but things usually work out), some of them should take out a coin and toss it 25 times (50 or 100 times would be much better, but who has time for that?) to obtain a random sequence of heads and tails. Some other students should just imagine throwing a fair coin and make up a sequence of 25 tosses in their mind. Each student then writes their sequence somewhere on the blackboard.

Upon returning to the classroom, I put on my magic hat, point to a sequence on the board, ask who wrote it, look deep into the eyes of the student and then make a prediction on whether the sequence is fake (i.e., made up) or real. Now, what impresses my students is that my prediction accuracy is (consistently) around 75%, much better than just guessing. How do I do it? I look at the length of the longest run of either heads or tails in the sequence and if it is less than 4, I declare the sequence fake, knowing very well that students (and humans in general) usually “underestimate” randomness and would not dare to write down 4 or more heads or tails in a row because they think that would immediately expose their sequence as fake (or because they cannot imagine such “extreme” a pattern when throwing a fair coin).

On the contrary, the fact is that 85% of real sequences of 25 tosses have a longest run of 4 or more (see the histogram below), so I should be able to identify many of the real sequences that students wrote down correctly but also expose many of the made up ones (although some smart students always manage to trick me) as fake. Actually, the expected length of the longest run in 25 tosses of a fair coin is 4.98, so roughly 5 tosses. The 95th percentile of the distribution of the longest run equals 8, so observing such a run-length may indicate that something “hot” is going on.

Here is a histogram showing the distribution of the longest run in 25 tosses,

and corresponding general R code to compute the length of the longest run is appended below. This code can be used to visualize the distribution of the longest run when the coin is not fair, e.g., in (professional) basketball the probability of making a successful throw is usually much higher than 50%, or under any other of multiple scenarios (i.e., deviations from Bernoulli trials). You may want to use it the next time you declare someone as hot!

General recursive formulas for exact computations on the distribution function of the longest run and many more results can be found in:

Mark F. Schilling, “The longest run of heads”, The College Mathematics Journal, Vol 21, Nr 3, May 1990.

R code:

longest.run <- function(tosses) { #computes length of longest run of heads or tails

max.run = 1 #initialize longest run

cur.run = 1 #initialize length of current run

l = length(tosses)

for(i in 2:l) {

if(tosses[i]==tosses[i-1]) cur.run = cur.run + 1

else cur.run = 1

if(cur.run>max.run) max.run = cur.run #keep track of longest run

}

return (max.run)

}

# Example:

my.toss=runif(25)<0.5 #this defines a sequence of tosses, where FALSE means Head, and TRUE means Tails

my.toss=sample(c(“Head”,”Tail”), size=25, replace=TRUE) #this also gives you a random sequence of Heads and Tails

longest.run(my.toss) #this returns the longest run in the sequence

#Let’s run a simulation to estimate the distribution of the longest run:

sims=10000

runs=matrix(NA,nrow=sims)

for (i in 1:sims) {

my.toss=sample(c(“Head”,”Tail”), size=25, replace=TRUE) #generate a random sequence of Heads and Tails

runs[i]=longest.run(my.toss)

}

hist(runs)

## Megamenu Social