r_PIR {ARPobservation} | R Documentation |
Generates random partial interval recording behavior streams
Description
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, which are then coded as partial interval recording data with given interval length and rest length.
Usage
r_PIR(
n,
mu,
lambda,
stream_length,
F_event,
F_interim,
interval_length,
rest_length = 0,
summarize = FALSE,
equilibrium = TRUE,
p0 = 0,
tuning = 2
)
Arguments
n |
number of behavior streams to generate |
mu |
mean event duration |
lambda |
mean interim time |
stream_length |
length of behavior stream |
F_event |
distribution of event durations. Must be of class |
F_interim |
distribution of interim times. Must be of class |
interval_length |
total interval length |
rest_length |
length of any recording time in each interval |
summarize |
logical value indicating whether the behavior streams should by summarized by taking their mean |
equilibrium |
logical; if |
p0 |
Initial state probability. 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 . |
Details
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. Then applies a partial interval recording filter to the generated behavior streams.
Value
If summarize = FALSE
, a matrix with rows equal to n
and a number of columns equal to the number intervals per session. If summarize = TRUE
a vector of means of length n
.
Author(s)
Daniel Swan <dswan@utexas.edu>
Examples
# An unsummarized set of PIR observations
r_PIR(n = 5, mu = 2, lambda = 4, stream_length = 20,
F_event = F_exp(), F_interim = F_exp(),
interval_length = 1, rest_length = 0)
# A summarized set of of PIR observations
r_PIR(n = 5, mu = 2, lambda = 4, stream_length = 20,
F_event = F_exp(), F_interim = F_exp(),
interval_length = 1, rest_length = 0,
summarize = TRUE)