Skip to contents

Simulates a (continuous time) random walk as a Brownian drift

Usage

random_walk(t, sigma = 1, mu = 0, y0 = 0)

Arguments

t

numeric vector with strictly increasing elements, can be heterodistant. Times at which the random walk is evaluated

sigma

positive scalar, variance parameter

mu

scalar, directionality parameter

y0

scalar, starting value (value of the random walk at the first entry of t)

Value

A list with elements t and y. t is a duplicate of the input parameter and is the times at which the random walk is evaluated. y are the values of the random walk at said times. Output list is of S3 class timelist (inherits from list) and can thus be plotted directly using plot, see ?admtools::plot.timelist

Examples


library("admtools") # required for plotting of results
t = seq(0, 1, by = 0.01)
l = random_walk(t, sigma = 3) # high variability, no direction
plot(l, type = "l")
l2 = random_walk(t, mu = 1) # low variabliity, increasing trend
lines(l2$t, l2$y, col = "red")