A random walk1 is a random process in which a state at time t is only dependent on the state at time t-1. Let us take a look at the following process:

\[\begin{equation*} X_{t} = X_{t - 1} + N(0, \sigma^2) \end{equation*}\]

with \(N(0,\sigma^2)\) being a normal distribution with mean 0 and variance \(\sigma^2\).

Simulate a random walk of 100 steps using the standard normal distribution (i.e. with \(\sigma^2 = 1\)):

In order to validate your (random) results, we set a seed for R’s random number generator, which you can leave as is.