Description Usage Arguments Details See Also
compute.session_rates
is a method for calculating the within-session rate of some variable. Currently, methods are defined for the classes analysis_object
and its child class simulation_analysis_object
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | compute.session_rates(data, event_offsets, dims = NULL,
session_duration = NULL)
## S4 method for signature 'formal_event_record,list,character,numeric'
compute.session_rates(data,
event_offsets, dims = NULL, session_duration = NULL)
## S4 method for signature 'formal_event_record,list,missing,numeric'
compute.session_rates(data,
event_offsets, session_duration)
## S4 method for signature 'formal_event_record,list,missing,missing'
compute.session_rates(data,
event_offsets)
## S4 method for signature 'formal_event_record,list,character,missing'
compute.session_rates(data,
event_offsets, dims = NULL, session_duration = NULL)
## S4 method for signature 'ragged_event_record,list,character,numeric'
compute.session_rates(data,
event_offsets, dims = NULL, session_duration = NULL)
## S4 method for signature 'ragged_event_record,list,missing,numeric'
compute.session_rates(data,
event_offsets, session_duration)
## S4 method for signature 'ragged_event_record,list,character,missing'
compute.session_rates(data,
event_offsets, dims)
## S4 method for signature 'ragged_event_record,list,missing,missing'
compute.session_rates(data,
event_offsets)
|
data |
Either an object of class |
dims |
A character vector of variable names to calculate the rates of. Defaults to |
session_duration |
A numeric value specifying the duration of the session over which the rates are calculated. Defaults to |
rft_duration |
A list with each element being a numeric specifying the reinforcemnt duration and the name of each element corresponding to the reinforcement event. |
session_duration = NULL
When data
is of class simulation_analysis_object
, the session duration is taken as the maximum recorded time for the list of variables for which rates are calculated. Note that the variables associated with reinforcement delivery in rft_duration
are automatically included in determining the session duration.
When the data
is of class analysis_object
, the session duration is taken as the time associated with the last entry in the event_time
data frame.
When the data
is of class dataset
, the compute.session_rates
method for the analysis_object
is just looped over all the analysis_object
s contained in the dataset
object.
When the rate is calculated, regardless of the method, the number of times that a particular event occurs is divided by the session time. The session time is corrected by the time that is taken up by reinforcement deliveries. The session time taken up by reinforcement is calculated as rft_time * rft_number. A further correction is done when the last event in the simulation or experiment is a reinforcement delivery, where the session time taken by reinforcement is calculated as rft_time * (rft_number-1).
dataset
To calculate the rates for the multiple sessions that are stored in a dataset
object, we essentially call lapply
over all of the analysis_objct
s in the dataset
.
With respect to efficiency, the compute.session_rates
method for simulation_analysis_object
is about 5 times faster than the method for analysis_object
. For standard data analysis, where time is not a big concern, either method is fine. In fact, the method using analysis_object
may be better because it uses the event_time
dataframe in the parent analysis_object
class, so it is functionally more convenient. When doing simulations, time is a concern. Hence, the method with simulation_analysis_object
should be used. Hopefully, this gives the reader some understanding about the design rationale for this method.
class.analysis_object
For constructing arguments for data
parameter.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.