format.time_event: Convert the data format created by a simulation to time-event...

Description Usage Arguments Note See Also

Description

In a simulation, the typical data format (the default from a input object) will be an environment that contains vectors of times at which events occurred, with separate lists for each different type of event (see class.input). The generic data format is "time-event", where the data is an n by 2 matrix, where n is the number of events that occurred during the experiment. The first column gives the time at which an event occurred and the second column gives the event that occurred. Outside of a simulation, the "time-event" format is preferred. Hence, we have functionality to convert from the "event-list" format to the "time-event" format.

Usage

1
2
3
4
format.time_event(data, dims)

## S4 method for signature 'input'
format.time_event(data, dims = NULL)

Arguments

data

A input object.

dims

A character vector specifying the dimensions of input to put in the time-event data. Defaults to NULL which means that everything is kept. See notes.

Note

The ordering of the elements in dims is very important. In many cases, events will occur at the same time. For example, if reinforcement is contingent on responding, then the time associated with reinforcement will be recorded as the same time as the response.

The implementation of the format.time_event function is that an n by 2 matrix is constructed, where n is computed by summing over the counts for the events specified by dim. Then, going through each type of event, as they are listed in dims, the "time" vector is filled in by copying the times in the associated input for the given variable. This is repeated for all event types in dims. The n by 2 matrix is then ordered by the time at which events occurred. Ties are resolved by the original ordering of the events. Hence, the order of events in the dims argument is important for getting the contingency of events correct. For example, if reinforcement is contingent on responding, then dims = c("resp_time", "rft_time") ) is the required order so that responses come before their associated reinforcement delivery.

See Also

tidy.simulation which uses format.time_event.


Don-Li/CAB_original documentation built on May 6, 2019, 2:53 p.m.