0

While studying Random Numbers, I have come across brownian motion. In the text I am using (Numerical Analysis by Sauer); there is an example (chapter 9, example 9.9) where the author illustrates how a monte carlo simulation is used to estimate the escape time for a random walk escaping the interval [-3,6].

The expected value is ab = 18 and the author provides the following table:-

$$ \begin{array}{c} \text{n} & \text{average escape time} & \text{error}\\ 100 & 18.84 & 0.84 \\ 200 & 17.47 & 0.53 \\ 400 & 19.64 & 1.64 \\ 800 & 18.53 & 0.53 \\ 1600 & 18.27 & 0.27 \\ 3200 & 18.16 & 0.16 \\ 6400 & 18.05 & 0.05 \end{array} $$

Am totally lost as to how the average escape times are calculated given monte carlo simulaion is used. Do I use an LCG? Can someone help advise? Please note that the previous example arrives at top exits and probabilities and am completely lost on how the book does it!

user76020
  • 123
  • Do you know any R? Or Matlab? – Hans Engler Nov 18 '13 at 00:18
  • yes I do know Matlab... – user76020 Nov 18 '13 at 00:21
  • I don't understand what your question is. Are you asking how he generates random numbers; how he uses a sequence of random numbers to simulate brownian motion; or how he calculates the escape times? – Stephen Montgomery-Smith Nov 18 '13 at 01:15
  • I am not clear on how he generates the random numbers, how he simulates the brownian motion and how he calculates the escape times....am just totally lost....I need to see a full worked example; I do however know how to generate pseudo random numbers – user76020 Nov 18 '13 at 01:34

1 Answers1

0

I implemented this in Google Spreadsheets (recently upgraded, with much better performance). Here is how it looks (explanation below):

spreadsheet with random walk

The column B is filled with zeroes, initial position. The time axis is horizontal, from left to right. Each entry in columns C,D,E,... is a conditional statement based on its neighbor to the left (preceding state of the walk). If the walk reached the border, the statement prints "stop". If it did not, then a coin is tossed with RAND() function, and a step is made to the left -1 or to the right +1. The process repeats. The command shown on the screenshot is in cell G37:

=IF(F37<=-3,"stop",IF(F37>=6,"stop",IF(RAND()<0.5,F37-1,F37+1)))

Column A counts the number of steps made before the stop: this is just the number of the numerical entrie in columns to the right of B. The command in A37 is

=COUNT(C37:AX37) 

(I figured that going to AX is enough for most walk instances to stop, but the spreadsheet could have been larger.)

Each of 50 rows is a path random walk. The average number of steps in this example turned out to be 18.08.

Of course, in Matlab etc you would use some kind of while loop for each path of the walk, and for loop to average over some number of oaths.