r_MTS {ARPobservation}R Documentation

Generates random momentary time sampling 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 momentary time sampling data with given interval length between moments.

Usage

r_MTS(
  n,
  mu,
  lambda,
  stream_length,
  F_event,
  F_interim,
  interval_length,
  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 eq_dist.

F_interim

distribution of interim times. Must be of class eq_dist.

interval_length

length of time between moments

summarize

logical value indicating whether the vector of moments should be summarized by taking their mean, excluding the first moment in each row.

equilibrium

logical; if TRUE, then equilibrium initial conditions are used; if FALSE, then p0 is used to determine initial state and normal generating distributions are used for event durations and interim times.

p0

Initial state probability. Only used if equilibrium = FALSE, in which case default is zero (i.e., behavior stream always starts with an interim time).

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 momentary time sampling filter to the generated behavior streams.

Value

If summarize = FALSE, a matrix of logicals with rows equal to n and length equal to (stream_length/interval_length) + 1. If summarize = TRUE, a vector of means of length n.

Author(s)

Daniel Swan <dswan@utexas.edu>

Examples


# A set of unsummarized MTS observations
r_MTS(n = 5, mu = 2, lambda = 4, stream_length = 20, 
       F_event = F_exp(), F_interim = F_exp(), interval_length = 1)
      
# A set of summarized MTS observations
r_MTS(n = 5, mu = 2, lambda = 4, stream_length = 20, 
       F_event = F_exp(), F_interim = F_exp(), 
       interval_length = 1, summarize = TRUE)
       

[Package ARPobservation version 1.2.2 Index]