A coin toss is a binary random experiment with two possible outcomes: heads or tails. A fair coin gives each outcome probability 0.5, and each toss is independent of the previous one. In R, represent heads and tails as 0 and 1, then simulate repeated tosses with sampling replacement. section 16.3
sample(x = c(0, 1), size = 10, prob = c(0.5, 0.5), replace = TRUE) ## [1] 0 1 1 1 1 1 1 0 1 0
Simulate ten fair coin tosses with base R's sample() function; each run can return a different sequence of zeros and ones. section 16.3
A useful coin-toss simulation follows four decisions:
- Choose the possible outcomes with x = c(0, 1), representing heads and tails. section 16.3
- Set size to the number of tosses, such as 10 for a short demonstration or 700 for a longer streak experiment. section 16.3 section 16.4.1
- Set prob = c(0.5, 0.5) for a fair coin rather than a weighted coin. section 16.3
- Set replace = TRUE so every toss remains an independent trial with the same probabilities. section 16.3
Long streaks do not prove a hot hand
A simulation of 700 fair coin tosses produced a maximum run of 11 tails. That result was comparable to Giannis Antetokounmpo's best free-throw streak, illustrating how random independent outcomes can create striking streaks without a persistent causal effect. The comparison supported treating his free-throw results as more coin-like than evidence of a hot hand. section 16.4.1 section 16.6
