#> source("c:/Work07/ShortCourse07/Programs/ARwalk1thin.txt",print.eval=TRUE)# #This a picture of a random walk# #recurrent for b<1 and transient for b>1# nsim<-2500; par(mfrow=c(2,2),mar=c(4.5,4.5,1.5,1.5)) m<-250 #number of points to plot step<-round(nsim/m) #--------------------------------------------------------- b<-.4;std<-1/sqrt(1-b^2); x<-0;y<-0;d<-20; for(i in 1:nsim){x<-c(x,b*x[[i]]+rnorm(1))} for(i in 1:nsim){y<-c(y,b*y[[i]]+rnorm(1))} xplot<-x[1];yplot<-y[1];for(i in 1:m) {xplot<-c(xplot,x[i*step]);yplot<-c(yplot,y[i*step])} plot(xplot,yplot,type="l",xlim=c(-3*std,3*std),ylim=c(-3*std,3*std),lwd=2,xlab="x",main=expression(theta==.4)) #--------------------------------------------------------- b<-.8;std<-1/sqrt(1-b^2) x<-0;y<-0;d<-20; for(i in 1:nsim){x<-c(x,b*x[[i]]+rnorm(1))} for(i in 1:nsim){y<-c(y,b*y[[i]]+rnorm(1))} xplot<-x[1];yplot<-y[1];for(i in 1:m) {xplot<-c(xplot,x[i*step]);yplot<-c(yplot,y[i*step])} plot(xplot,yplot,type="l",xlim=c(-3*std,3*std),ylim=c(-3*std,3*std),lwd=2,xlab="x",main=expression(theta==.8)) #--------------------------------------------------------- b<-.99;std<-1/sqrt(1-b^2) x<-0;y<-0;d<-20; for(i in 1:nsim){x<-c(x,b*x[[i]]+rnorm(1))} for(i in 1:nsim){y<-c(y,b*y[[i]]+rnorm(1))} xplot<-x[1];yplot<-y[1];for(i in 1:m) {xplot<-c(xplot,x[i*step]);yplot<-c(yplot,y[i*step])} plot(xplot,yplot,type="l",xlim=c(-3*std,3*std),ylim=c(-3*std,3*std),lwd=2,xlab="x",main=expression(theta==.95)) #--------------------------------------------------------- b<-1.1;x<-0;y<-0;d<-20; for(i in 1:nsim){x<-c(x,b*x[[i]]+rnorm(1))} for(i in 1:nsim){y<-c(y,b*y[[i]]+rnorm(1))} xplot<-x[1];yplot<-y[1];for(i in 1:m) {xplot<-c(xplot,x[i*step]);yplot<-c(yplot,y[i*step])} plot(xplot,yplot,type="l",xlim=c(-d,d),ylim=c(-d,d),lwd=2,xlab="x",main=expression(theta==1.001)) #---------------------------------------------------------