ARPobservation
This vignette describes the
algorithms used in ARPobservation
to simulate behavior
streams and direct observation recording data based on an alternating
renewal process. The ARP is a statistical model that can be used to
describe the characteristics of simple behavior streams, in which a
behavior of interest is either occurring or not occurring at a given
point in time. We will refer to the length of individual episodes of
behavior as event durations and the lengths of time between
episodes of behavior as interim times. In the ARP framework,
variability is introduced into the behavior stream by treating each
individual event duration and each interim time as a random quantity,
drawn from some probability distribution.
The sequence of events comprising the behavior stream can be described as follows. Let L denote the length of the observation session. Let A1 denote the duration of the first behavioral event observed, A2 denote the duration of the second event, and Au the duration of event u for u = 3, 4, 5, .... Let B0 denote the length of time from the beginning of the observation session until the first behavioral event, with B0 = 0 if event 1 is occurring at the beginning of the session. Let Bu denote the uth interim time, meaning the length of time between the end of event u and the beginning of event u + 1, for u = 1, 2, 3, .... The values B0, A1, B1, A2, B2, A3, B3, ... provide a quantitative description of the behavior stream from an observation session. Note that these quantities are measured in time units, such as seconds.
The ARPobservation
package generates behavior streams
that follow an alternating renewal process with specified generating
distributions. The package provides two approaches to generating the
initial interim time and initial event duration, which we explain
further below. Subsequent event durations A2, A3, A4, ...
are generated independently, following a specified probability
distribution with mean μ and
cumulative distribution function (cdf) F(t; μ).
Subsequent interim times B1, B2, B3, ...
are generated independently, following a specified probability
distribution with mean λ and
cdf G(t; λ).
The package currently includes functions for exponential
distributions, gamma distributions, mixtures of two gamma distributions,
Weibull distributions, uniform distributions, and constant values. Each
distribution is implemented as an object of class eq_dist
,
which provides functions for generating random deviates from the
specified distribution and the corresponding equilibrium distribution.
For distributions involving more than a single parameter, all parameters
except for the mean must be specified.
ARPobservation
provides two approaches to generating the
initial interim time and initial event duration. The first approach
involves the following steps:
If p0 is not specified by the user, the default value of p0 = 0 is used, so that behavior streams always begin with an interim time. This approach produces behavior streams that are initially out of equilibrium.
The other approach uses initial conditions chosen so that the resulting process is in equilibrium. This involves the following steps:
The package provides several algorithms that simulate commonly used direct observation recording procedures. Each algorithm takes as input a randomly generated behavior stream and produces as output a summary measurement (or measurements) from a direct observation procedure.
Event counting produces a measurement YE equal to the number of events that begin during the observation session. Let J denote the number of last behavioral event that begins during the observation session, which can be calculated by finding the integer that satisfies the inequalities $$ \sum_{j=0}^{J-1} \left(A_j + B_j \right) \leq L < \sum_{j=0}^{J} \left(A_j + B_j \right), $$ where we define A0 = 0 for notational convenience. It follows that YE = J.
Continuous recording produces a measurement YC equal to the proportion of the observation session during which the behavior occurs. In order to calculate this quantity from the behavior stream, we must account for the possibility that the last event beginning during the observation session may have a duration that extends beyond when the session ends. The measurement based on continuous recording can be calculated as $$ Y^C = \begin{cases} \frac{1}{L} \sum_{j=1}^J A_j & \text{if}\quad \sum_{j=1}^{J} \left(B_{j-1} + A_j\right) \leq L \\ 1 - \frac{1}{L} \sum_{j=0}^{J-1} B_j & \text{if}\quad \sum_{j=1}^{J} \left(B_{j-1} + A_j\right) > L \end{cases} $$
In momentary time sampling, an observer divides the observation session into K intervals of equal length and notes whether the behavior is present or absent at the very end of each interval. The summary measurement YM then corresponds to the proportion of moments during which the behavior is observed. Let Xk = 1 if the behavior is occurring at the end of interval k for k = 1, ..., K. The value of Xk can be calculated from the behavior stream as follows. Let I(X) denote the indicator function, equal to one if condition X is true and zero otherwise. Let mk be the number of the last event that ends before the kth interval ends, defined formally as $$ m_k = \sum_{i=1}^J I\left[\sum_{j=1}^i \left(B_{j-1} + A_j\right) < k L \right] $$ for k = 1, ..., K. If interim time Bmk concludes before the end of interval k (or equivalently, if event Amk + 1 begins before the end of interval k), then Xk = 1; formally, $$ X_k = I\left[\sum_{j=0}^{m_k} \left(A_j + B_j\right) < k L \right] $$ for k = 1, ..., K. The summary measurement is then calculated as $\displaystyle{Y^M = \sum_{k=1}^K X_k / K}$.
Like momentary time sampling, partial interval recording is also based on a set of K intervals of equal length, but a different rule is used to score each interval. In partial interval recording, the observer counts a behavior as present if it occurs at any point during the first c time units of the interval, where c ≤ L/K; the remaining L/K − c time units are used to record notes or rest. Let Uk = 1 if the behavior occurs at any point during the kth interval, Uk = 0 otherwise. The kth interval will be equal to one if and only if interim time mk − 1 ends during the active part of the interval. Noting that interim time mk − 1 ends at time $\sum_{j=0}^{m_{k-1}} \left(A_j + B_j\right)$ and that the active part of the kth interval ends at time (k − 1)L + c, it can be seen that $$ U_k = I \left[\sum_{j=0}^{m_{k-1}} \left(A_j + B_j\right) < (k-1)L + c \right], $$ for k = 1, ..., K. The summary measurement YP is then calculated as the proportion of intervals during which the behavior is observed at any point: $\displaystyle{Y^P = \sum_{k=1}^K U_k / K}$.
Whole interval recording is similar to partial interval recording but uses yet a different rule to score each interval. Specifically, the observer counts a behavior as present only if it occurs for all c time units at the beginning of the interval. Let Wk = 1 if the behavior occurs for the duration, with Wk = 0 otherwise. Let nk be the number of the last event that begins before the kth interval begins, defined formally as $$ n_k = \sum_{i=1}^J I\left[\sum_{j=0}^i \left(A_j + B_j\right) < (k - 1) L \right] $$ for k = 1, ..., K. It follows that Wk will be equal to one if and only if event nk ends after the active part of interval k: $$ W_k = I \left[\sum_{j=1}^{n_k} \left(B_{j-1} + A_j\right) \geq (k - 1) L + c \right], $$ for k = 1, ..., K. The summary measurement YW is then calculated as the proportion of intervals during which the behavior is observed at any point: $\displaystyle{Y^W = \sum_{k=1}^K W_k / K}$.