I'm trying to plot multiple simple Random Walks in R, but am having problems doing so.
Please be aware that by simple Random Walk I mean the Sum of Random Variables that can either be {-1} or {1} with each values having the same probability, not some Random Walk absed on white Noise. (see the definition on https://en.wikipedia.org/wiki/Random_walk#One-dimensional_random_walk )
I use the following code to plot the Random Walks:
set.seed(1)
n <- 200
Random_Walk<- cumsum(sample(c(-1, 1), n, TRUE))
n <- 200
Random_Walk_2 <- cumsum(sample(c(-1, 1), n, TRUE))
ts.plot(Random_Walk, gpars=list(xlab="Length of Random Walk", ylab="Distance from origin",lty=c(1:1)))
This code works fine, but once I try to plot both Random Walks in the same Graph it breaks. Can someone explain how i could plot both of them or even multiple Random Walks in one Graph?
Additionally I was wondering whether there is some tools that could give me the variance or the standard deviation of all those Random Walks
Thank you all in advance!!