R: Applies interval recording to a behavior stream
interval_recording
R 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.
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.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(ARPobservation)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ARPobservation/interval_recording.Rd_%03d_medium.png", width=480, height=480)
> ### Name: interval_recording
> ### Title: Applies interval recording to a behavior stream
> ### Aliases: interval_recording
>
> ### ** 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)
[,1] [,2] [,3] [,4] [,5]
[1,] 1 1 1 1 1
[2,] 1 1 1 1 1
[3,] 1 1 1 1 1
[4,] 0 1 1 1 1
[5,] 1 1 1 1 1
> interval_recording(BS, interval_length = 20, partial = TRUE, summarize = TRUE)
[1] 0.8 1.0 1.0 1.0 1.0
> colMeans(interval_recording(BS, 20, partial = TRUE, summarize = FALSE))
[1] 0.8 1.0 1.0 1.0 1.0
> interval_recording(BS, interval_length = 20, rest_length = 5, partial = FALSE)
[1] 0 0 0 0 0
>
>
>
>
>
> dev.off()
null device
1
>