# Random walk reflection principle diagram #4 walk <- c(0,-1,0,1,2,3,2,3,4,3,4,3) n <- length(walk)-1 t <- 0:n # Plot the walk plot(t, walk, ylab="position", xlab="time", type="l", ylim=c(-1,5)) # Horizontal axis for the parameter a haxis <- (-20:40*n)/40 points(haxis, rep(5, length(haxis)), pch=".") text(0, 5, labels="a", pos=1) # Horizontal axis for the parameter a-1 haxis <- (-20:40*n)/40 points(haxis, rep(4, length(haxis)), pch=".") text(0, 4, labels="a-1", pos=1) # Vertical axis for the parameter n vaxis <- (-20:300*n)/40 points(rep(n, length(vaxis)), vaxis, pch=".") text(n, 0, labels="n", pos=2) # Vertical axis for the parameter n-1 vaxis <- (-20:300*n)/40 points(rep(n-1, length(vaxis)), vaxis, pch=".") text(n-1, 0, labels="n-1", pos=2) text(n, 3, labels="x", pos=2)