* * Graphs from section 11.3, pp 374-376 * all 50 * * These generate random walks with N(0,1) increments. The first option pegs the * first value to 0. (If you don't use this or something like it, the series will * be all NA's, since there won't be a lag to compute the first data point). * * Note that these won't reproduce the series shown in the book, since those are * based upon another set of random numbers. In fact, as written, you won't be * able to reproduce the results graphed here if you rerun the program. If you * want to control the "random" numbers chosen (actually, they're more * appropriately known as pseudo-random), use the SEED instruction somewhere near * the top of the program (for instance, SEED 95039). * set(first=0.0) rw1 = rw1{1}+%ran(1.0) set(first=0.0) rw2 = rw2{1}+%ran(1.0) graph(footer="Figure 11.1 Two Realizations of a Random Walk") 2 # rw1 # rw2 * * Drifting random walk with N(0,9) increments. Note that %ran takes as its * argument the standard deviation, thus 3 in this case. * set(first=0.0) rwd = 2.0+rwd{1}+%ran(3.0) set trend = 2.0*(t-1) graph(footer="Figure 11.3 Realization of a Random Walk with Drift") 2 # rwd # trend