Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

What is the expected length of a streak of heads or tails when flipping a coin? What distribution is this?

I'm pretty sure the answer is 2. But I don't know what distributions it is..

I did the following R code:

l=10000
longest.stk = avg.stk = numeric(l)
for(i in 1:l){
x=sample(0:1, 1000, repl=T)
r = rle(x) 
longest.stk[i] = max(r$lengths)  
avg.stk[i] = mean(r$lengths) }
mean(longest.stk) 
[1] 10.3001
mean(avg.stk)           
[1] 2.000825
share|improve this question

1 Answer

It's the expected value of a geometric distribution with $p=0.5$, which is $1/(1-p)$.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.