simulate data from a second order random walk

simulate_rw(sigma = NULL, tau = NULL, length = 10, start = 1,
  order = 1, n_sim = 1000)

Arguments

sigma

the standard deviation of the random walk process

tau

the precision of the random walk process

length

the length of the time series

start

the starting values of the time series

order

1 for first order random walk or 2 for second order random walk

n_sim

the number of simulations

Value

a data.frame with simulated time series from the random walk

See also

Examples

set.seed(20181202) x <- simulate_rw(sigma = 0.1, start = -10, length = 40) head(x)
#> # A tibble: 6 x 3 #> x y replicate #> <dbl> <dbl> <int> #> 1 -10 0 1 #> 2 -9 -0.0770 1 #> 3 -8 -0.313 1 #> 4 -7 -0.560 1 #> 5 -6 -0.634 1 #> 6 -5 -0.688 1
y <- simulate_rw(sigma = 0.001, start = -10, length = 40, order = 2) head(y)
#> # A tibble: 6 x 3 #> x y replicate #> <dbl> <dbl> <int> #> 1 -10 0 1 #> 2 -9 0 1 #> 3 -8 -0.000880 1 #> 4 -7 -0.00264 1 #> 5 -6 -0.00397 1 #> 6 -5 -0.00490 1