The basic idea of the simulation is that if the geometric random walk model of (1) is true, then the at's are given by
![]() |
(2) |
![]() |
(3) |
Here's the Splus code to do the shuffling and plotting. The ``cumsum'' function computes cumulative sums - exactly what is needed to undo the differencing.
> #First get help on the "sample" function. I always forget how it works. > help(sample,window=T) Starting an X11 help window for 'sample' with less as the pager. > #OK, the plain vanilla sample function is all I need for > # randomly reshuffling the dldj values. But first let's get a random > # sample of size 1 from the integers 1 to 20 to get random spot for the > # real one. > real1_sample(1:20,size=1) > # Oh, yeah, let's try out the cumsum function on a trivial case: > # get the cumulative sums of the sequence 1,2,3: > cumsum(1:3) [1] 1 3 6 > # Notice it doesn't start at 0, so I have to add that in > par(mfrow=c(4,5)) #this says to plot multiple figures by rows in > # a 4 by 5 matrix of plots > for(i in 1:20) { + if(i == real1) tsplot(dj) + else tsplot(10^(dj[1]+c(0,cumsum(sample(dldj)))))} > #Hmm. I think I know where it is. Let's see if I'm right. > real1 [1] XX-CENSORED > #that's it! Ask me if things aren't clear to you.The plot is in Figure 3. Can you spot the real one? Of course, if you went to class, you know where it is.