* * Realizations of AR(1) processes from page 55. * * Note that these use random numbers. They won't match * the graphs in the text. If you want to be able to get * your own graphs to match from one run to another, use * the SEED instruction at the top of the program. The syntax * for this is SEED big integer, like SEED 53435. RATS (like * almost all software) can only generate "pseudo-random" * numbers. These are generated systematically from a seed value, * but pass virtually any test for randomness. From a fixed * seed, you will always get the same numbers. * all 100 * * The AR(1) processes use the "FIRST" option on SET to choose * a different formula for the initial data point, since it * doesn't have a lag for the recursive definition. This is * a draw from the unconditional distribution, see 3.4.4 for * the calculation of the unconditional variance of an AR(1) * process. * set ywn = %ran(1.0) set(first=%ran(1.0)/(1-.5**2)) y5 = .5*y5{1}+%ran(1.0) set(first=%ran(1.0)/(1-.9**2)) y9 = .9*y9{1}+%ran(1.0) grparm(font=symbol) hlabel 24 spgraph(vfields=3,header='Figure 3.3 Realizations of an AR(1) Process') graph(hlabel='f=0') # ywn graph(hlabel='f=0.5') # y5 graph(hlabel='f=0.9') # y9 spgraph(done)