R: Generates random partial interval recording behavior streams
r_PIR
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.
distribution of event durations. Must be of class eq_dist.
F_interim
distribution of interim times. Must be of class eq_dist.
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 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 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)
Results
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/r_PIR.Rd_%03d_medium.png", width=480, height=480)
> ### Name: r_PIR
> ### Title: Generates random partial interval recording behavior streams
> ### Aliases: r_PIR
>
> ### ** 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)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14]
[1,] 1 1 1 1 1 0 0 0 0 0 0 0 1 1
[2,] 0 0 0 0 0 0 0 0 0 0 0 1 1 0
[3,] 0 0 0 1 1 1 1 1 0 0 1 1 1 1
[4,] 0 0 0 0 0 0 1 1 1 1 1 1 1 1
[5,] 1 1 1 1 1 1 1 1 1 0 0 1 1 1
[,15] [,16] [,17] [,18] [,19] [,20]
[1,] 1 1 0 0 0 0
[2,] 1 1 0 1 1 1
[3,] 0 0 0 0 0 1
[4,] 0 0 0 0 0 0
[5,] 1 0 0 0 0 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)
[1] 0.05 0.40 0.65 0.55 0.45
>
>
>
>
>
> dev.off()
null device
1
>