Friday, June 22, 2012

1-D Random Walk with Equal Probability

This is the absolutely fundamental case of random walk. Start from position 0 on an one-dimensional number line. One unit step is taken on each step, with equal probability of going to the left and the right. The number of times stopped on each position is kept track. What's the distribution like after many steps?

It turns out that because the probability of moving in either direction is independent of the current position, increasing the number of steps in each trial doesn't help to reduce much variance. Instead, "resetting" the trials back to position 0, while keeping and continuing the tracking, helps to yield a smoother distribution curve. For this exercise, 100,000 runs were simulated, each with 1 million steps. In another word, 1 million steps were simulated, the position reset to 0, another 1 million steps simulated, the position reset to 0, and so forth until 100,000 of such cycles were completed. Overall, that's 100 billion steps. Here was the result:

Upon extraction of variable values, the following useful data were attained:
  • Most extreme positive value landed on: 4,729
  • Most extreme negative value landed on: 4,900
  • Number of times landed on position 0: 79,820,608
  • Percentage of time position was between [-100, 100]: 15.07%
  • Percentage of time position was between [-500, 500]: 58.15%
  • Percentage of time position was between [-1000, 1000]: 85.00%
  • Percentage of time position was between [-2000, 2000]: 98.85%