View source: R/simulate_behavior_stream.R
r_behavior_stream | R Documentation |
Random generation of behavior streams (based on an alternating renewal process) of a specified length and with specified mean event durations, mean interim times, event distribution, and interim distribution.
r_behavior_stream(
n,
mu,
lambda,
F_event,
F_interim,
stream_length,
equilibrium = TRUE,
p0 = 0,
tuning = 2
)
n |
number of behavior streams to generate |
mu |
vector of mean event durations |
lambda |
vector of mean interim time |
F_event |
distribution of event durations. Must be of class |
F_interim |
distribution of interim times. Must be of class |
stream_length |
length of behavior stream |
equilibrium |
logical; if |
p0 |
vector of initial state probabilities. Only used if |
tuning |
controls the size of the chunk of random event durations and interim times. Adjusting this may be useful in order to speed computation time . |
Generates behavior streams by repeatedly drawing random event durations and
random interim times from the distributions as specified, until the sum of the durations and interim
times exceeds the requested stream length. The vectors mu
, lambda
, and p0
are
recycled to length n
.
An object of class behavior_stream
containing two elements.
# default equilibrium initial conditions
r_behavior_stream(n = 5, mu = 3, lambda = 10,
F_event = F_exp(), F_interim = F_exp(),
stream_length = 100)
# non-equilibrium initial conditions
r_behavior_stream(n = 5, mu = 3, lambda = 10,
F_event = F_gam(3), F_interim = F_gam(3),
stream_length = 100,
equilibrium = FALSE, p0 = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.