* * ACF's of generated series * all 250 * * The unconditional distribution of the AR(1) process is y(t)~N(0,4.0/(1-.7**2)). * We use SET with the FIRST option to draw the first value from the unconditional * density; then the others are created by applying the conditional model. Note * that the RATS %ran function (which draws independent normals) takes the * standard deviation as the argument, not the variance. * * Note that because this is based upon (pseudo) random numbers, the output will * not match that shown in the text. If you want a RATS program to generate the * same "random" numbers each time, you can use the SEED instruction. The syntax * of this is SEED big integer. For instance, if you take the comment * off the * front of the next instruction, you'll get the same results each time you run * this program. * *SEED 950343 set(first=%ran(sqrt(4.0/(1-.7**2)))) y = .7*y{1}+%ran(2.0) graph(footer="Figure 14.3 AR(1) Process with rho=.7") # y @bjident(number=12,method=yule,qstats,report) y * * An MA(1) process is also fairly easy to create. You generate a series of * shocks, then create a second series from the moving average of that one. Again, * we use SET with the FIRST option to take care of the first observation, which * can't be computed using the standard formula because there is no lagged value * of u available. * set u = %ran(2.0) set(first=u(1)+.4*%ran(2.0)) x = u+.4*u{1} graph(footer="Figure 14.5 MA(1) Process with theta=.4") # x @bjident(number=12,method=yule,qstats,report) x