Purpose
Intuition is a poor guide to the stats, especially relating to random walks. Lets see how it goes. Generate 100000 paths of 200 sequence length .Last Visit since 0

> M <- 200
> N <- 1e+05
> realizations <- matrix(data = rnorm(M * N), ncol = N)
> results <- vector()
> for (i in seq_along(realizations[1, ])) {
+     x <- cumsum(sign(realizations[, i]))
+     temp <- max(which(x == 0))
+     results <- c(results, temp)
+ }
> x <- seq(0.01, 0.99, 0.01)
> y <- 1/(pi * sqrt(x * (1 - x)))
> par(mfrow = c(1, 2))
> hist(results/M, prob = T, main = "")
> plot(x, y, type = "l")

RWalks2-001.jpg

You might have assumed that the last visit would be somewhere near 100.. But intuition is a bad thing in random walks. The resulting distribution is an arc sine distribution.

The fraction of the time the particle spends on one side.
Again intuition is a wrong guide.

> results <- vector()
> for (i in seq_along(realizations[1, ])) {
+     x <- cumsum(sign(realizations[, i]))
+     temp <- length(which(x > 0))/length(x)
+     results <- c(results, temp)
+ }
> par(mfrow = c(1, 1))
> hist(results/M, prob = T, main = "")

RWalks2-002.jpg

Sign Changes
Here is another paradox, the probability that there will be exactly r sign changes…If I toss 200 times a coin, you would expect atleast 100 sign changes if you do it million times.again intuition is against the simulation result Look at the result.

> results <- vector()
> i <- 1
> for (i in seq_along(realizations[1, ])) {
+     x <- (cumsum((realizations[, i])))
+     t <- length(x)
+     temp <- length(which(x[1:(t - 1)] * x[2:t] < 0))
+     results <- c(results, temp)
+ }
> par(mfrow = c(1, 1))
> hist(results, prob = T, main = "")

RWalks2-003.jpg