/2D-Random-Walk

Generating simple random walk using R

Primary LanguageR

2D Random Walk Using R

Random Walk using R

This is an example of creating a Random walk using R programming. Here we have tried to build a data frame that consists of the steps taken in the walk. These steps are generated based on a condition that is in turn dependent upon a random value picked up from a sample space.

This code follows these instructions:

  1. Initiating the initial steps
  2. If the random value of dice thrown is satisfying a condition ( say <= 4 or >= 3) then we mode if forward which is +1 else backward -1
  3. This is iterated over and over again until the loop reaches its maximum limit.
  4. Plotting the final positions of the is the graph generated which is also called as "2D Random Walk" alt text