interval_recording: Applies interval recording to a behavior stream

View source: R/observation_method_filters.R

interval_recordingR Documentation

Applies interval recording to a behavior stream

Description

Divides the observation session into a specified number of intervals. For partial interval recording, each interval is scored according to whether the behavior is present at any point during the interval. For whole interval recording, each interval is scored according to whether the behavior is present for the duration.

Usage

interval_recording(
  BS,
  interval_length,
  rest_length = 0,
  partial = TRUE,
  summarize = TRUE
)

Arguments

BS

object of class behavior_stream

interval_length

time length of each interval.

rest_length

portion of each interval to exclude from observation. Default is zero. See details.

partial

logical value indicating whether to use partial interval recording (TRUE) or whole interval recording (FALSE).

summarize

logical value indicating whether vector of moments should be summarized by taking their mean.

Details

Each behavior stream is divided into intervals of length interval_length. The last rest_length of each interval is excluded from observation. For example, for a stream length of 100, interval_length = 20, and rest_length = 5, the first interval runs from [0,15), the second interval runs from [20,35), etc.

Value

If summarize = FALSE, a matrix with rows equal to the number of intervals per session and columns equal to the number of behavior streams in BS. If summarize = TRUE, a vector of proportions of length equal to the number of behavior streams in BS.

Examples

BS <- r_behavior_stream(n = 5, mu = 3, lambda = 10, 
                       F_event = F_exp(), F_interim = F_exp(), stream_length = 100)
interval_recording(BS, interval_length = 20, partial = TRUE, summarize = FALSE)
interval_recording(BS, interval_length = 20, partial = TRUE, summarize = TRUE)
colMeans(interval_recording(BS, 20, partial = TRUE, summarize = FALSE))
interval_recording(BS, interval_length = 20, rest_length = 5, partial = FALSE)

ARPobservation documentation built on Aug. 25, 2023, 5:19 p.m.