Emrah Mete simulates a random walk in R:

Let’s consider a game where a gambler is likely to win $1 with a probability of

pand lose $1 with a probability of1-p.Now, let’s consider a game where a gambler is likely to win $1 and lose $1 with a probability of

1. The player starts the game withXdollars in hand. The player plays the game until the money in his hand reachesN (N> X)or he has no money left. What is the probability that the player will reach the target value? (We know that the player will not leave the game until he reaches theNvalue he wants to win.)The problem of the story above is known in literature as Gambler’s Ruin or Random Walk. In this article, I will simulate this problem with R with different settings and examine how the game results change with different settings.

Click through for the script and analysis. There’s a reason they call this game the gambler’s ruin.

Kevin Feasel

2018-02-12

R