random_walk | R Documentation |
Simple function to simulate a random walk
random_walk(x = 1:100, y0 = 100, sd = 1, mu = 0)
x |
independent variable values (e.g. vector of time steps) |
y0 |
Initial value of y |
sd |
Standard deviation of normal error distribution |
mu |
multiplicative drift parameter |
## Not run:
plot(random_walk(),type="l")
plot(random_walk(),random_walk(),type="l")
# Random walks can be pretty
x <- 1:1000
y1 <- random_walk(x)
y2 <- random_walk(x)
plot(y1,y2,type="l")
points(y1,y2,type="p",pch=16,col=rainbow(length(x)))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.