3
$\begingroup$

Say you're playing a game. Each win = 1 point. Each loss = -1 point. Win rate is 50%. How do you calculate the expected value of the number of games needed to get to 5 points?

$\endgroup$
4
  • 1
    $\begingroup$ Is this a question from a course or textbook? If so, please add the [self-study] tag & read its wiki. $\endgroup$ Commented Dec 2, 2015 at 18:36
  • $\begingroup$ It's for a game I'm playing and I was curious how this could be calculated. This just came in mind because I'm following statistics in college :P $\endgroup$
    – Andy
    Commented Dec 2, 2015 at 18:54
  • 2
    $\begingroup$ Are you interested in the number of games until there is a winner - some person gets to 5 - no matter which player? Or the number of games until a particular player wins? $\endgroup$
    – Glen_b
    Commented Dec 3, 2015 at 0:00
  • $\begingroup$ I'm interested in the calculation of the number of games until you are the winner - until you get 5 points. $\endgroup$
    – Andy
    Commented Dec 3, 2015 at 17:27

2 Answers 2

8
$\begingroup$

This question can be reformulated as a simple one dimensional random walk that steps up or down with probability $1/2$ and $\tau$ is the waiting time to reach 5 points (also known as the first passage time), so you are interested in $E[\tau]$. By setting up a recursion, it can be shown that $E[\tau]=\infty$. This does not imply the walk never hits 5, just that the expectation diverges.

$\endgroup$
3
  • $\begingroup$ Thank you for your answer! Too bad my statistic knowledge is lacking, so i can't follow everything about that recursion. Is there a general formula and is this different for Winrate>50%, Winrate=50% and Winrate<50%? $\endgroup$
    – Andy
    Commented Dec 2, 2015 at 23:39
  • $\begingroup$ By looking at the recursion, as far as I come is that E(S)=W%*S+(L%)*(S+E(S)+E(S)) which would deduct to E(S)=S/(1-2*L%) with W%/L%=Win/Lose rate and S=Score. Which would mean with Win rate close to +50% that: E(5) = 1/~+0 = Infinite, and E(5) with Win rate 60% = 25, and E(S) with Win rate < 50% = Negative, which is invalid. Am I right? $\endgroup$
    – Andy
    Commented Dec 3, 2015 at 17:42
  • 1
    $\begingroup$ +1 This is the right answer, @Andy. The math may a bit involved, but here's a document that walks you through the answer. $\endgroup$ Commented Dec 4, 2015 at 4:16
0
$\begingroup$

The poster asks how to calculate the expected value. As others have suggested, one must know the specific sequence of the events to understand the sum of the events. The closest we can come to calculating the result would be the binomial distribution, as others have already demonstrated.

I was interested in the question and wanted to provide some sense of the number of turns, as originally asked. I used a Monte Carlo method, similar to Antoni's solution. In R code:

eq5 <- 0
for (j in 1:100000){
  sum <- 0
  trial <- 0
  turn <- 0

  for (i in 1:100){
    trial[i] <- sample( c(-1,1) ,1 , replace=TRUE)
    sum <- cumsum(trial)
    turn <- i
    if(sum[i] ==5) break
  }
  eq5[j] <- turn
}

hist(eq5, xlim=c(0,100), breaks=c(0:100), xaxt="n")
axis(side=1, at=c(0:100))
table(eq5)

Distribution of turns where expected value = 5

Note: I ran only 100 turns causing a truncation of the very long right-sided tail.

The most common number of turns where a value of 5 occurs is shared between the 7th and 9th turn.

$\endgroup$
4
  • $\begingroup$ Thanks! Which program did you use to plot this graph? $\endgroup$
    – Andy
    Commented Dec 5, 2015 at 18:03
  • $\begingroup$ In the final sentence did you really mean to suggest that the expectation (which is what the question asks for) is the same as "the most common number"? Please note, too, that 5 cannot be attained on the tenth turn: the mode is shared by the values 7 and 9. $\endgroup$
    – whuber
    Commented Dec 7, 2015 at 14:36
  • $\begingroup$ whuber- you are correct in each of your statements. I ran 10^6 simulations to confirm your point regarding the shared mode. Did you arrive at that conclusion by means other than a Monte-Carlo approach? I have edited my answer to reflect your comments. Lastly, regarding the formal 'expectation,' my answer is not the formal expectation, but addresses the OP's desire for a "calculation of the number of games until you are the winner." $\endgroup$
    – Todd D
    Commented Dec 9, 2015 at 16:52
  • $\begingroup$ This question has an accessible theoretical answer, Todd. Look up information on random walks with absorbing barriers, as in Cox & Miller Chapter 3. $\endgroup$
    – whuber
    Commented Dec 9, 2015 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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