rwalk | R Documentation |
The last year of an FLQuant
object is used as atrating point to generate
a time series following a random walk with drift:
z_t = z_{t-1} + \epsilon_t + \delta_t, t=1,2,...
where \epsilon
is \mathcal{N}(0, \sigma)
rwalk(x0, end = 1, sd = 0.05, delta = 0)
x0 |
The initial state of the random walk, 'FLQuant'. |
end |
The number of years or the final year of the series. numeric. |
sd |
The standard deviation of the random walk, numeric. |
delta |
The drift of the random walk. |
The length of the series is set by argument end. This is taken as a number of years, if its value is smaller than the final 'year' of 'x0', or as a final year if larger or of class 'character'.
An 'FLQuant' object.
Iago Mosqueira, WMR (2023)
FLQuant rnorm
data(ple4)
# Generate random walk recruitmrnt with positive drift
rwalk(rec(ple4), end=5, sd=0.08, delta=0.05)
# Use append() to add the new values at the end
append(rec(ple4), rwalk(rec(ple4), end=10, sd=0.04, delta=0))
# Use end as number of years
rwalk(rec(ple4), end=5)
# or as final year
rwalk(rec(ple4), end=2020)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.