# generate the random walk # generate the noise (innovations) set.seed(6) # standard normal parameters mu=0.0 sd=1 #generate n, N(0,1) RVs n=100 e=rnorm(n=n,mean=mu,sd=sd) # make plot region 2 x 2 par(mfrow=c(2,2)) # time plot of the innovations plot(e, type="l") abline(h=0,col='blue') plot(e,type='b') abline(h=0,col='blue') plot(e,type='o') abline(h=0,col='blue') # generate random walk: Y_t = Y_t-1 + e_t y=cumsum(e) plot(y,type='o', xlab="Time", ylab="Y_t") abline(h=0,col='blue') title("Random Walk")