class.event: Event Function class

Description Usage Format Details Slots Built-in event functions Make an event object from a event function See Also Examples

Description

Event functions are general functions for representing environmental events. That is, their primary use is for reinforcement schedules.

Usage

1
2
3

Format

The show method prints the function that is contained in the event object as well as the type of object (i.e. "elemental") and the class (i.e. "event" ).

Details

In the CAB package, objects from classes like event are called 'elemental' objects That is, they comprise a particular element of the simulation without any specified parameter values. 'Control' objects are elemental objects with an associated list of parameter values. Refer to class.DOR for information for putting a event in a model.

When the event object is used to contain a reinforcement schedule, the entire schedule should be programmed into the Event function that is contained in the event object. Alternatively, one may define different custom classes such as event1 and event2 to manage different parts of the schedule (for example, event1 and event2 may manage reinforcement schedules on two keys on a concurrent schedule). If the user wishes to create separate classes for parts of reinforcement schedules, then it is up to the user to make sure that they interact properly.

The show method for the event class can be removed with the function remove.event.show() and reinstated with event.show.

Slots

event

This will contain a event function. See examples.

name

The name of the event object.

type

This will be elemental because the event is an elemental object.

Built-in event functions

A list of the built-in event functions. The function definitions can be seen by calling the name of the function without brackets. Each of these functions return the next time (or number of responses) when reinforcement is arranged.

true_VI_fx(VI_interval, time)

A variable-interval schedule where the next food is arranged at a time that is sampled from an Exponential distribution. The density is:

f(t; λ) = 1/λ * e^(- 1/λ * t )

where λ is the arranged inter-reinforcement interval. See rexp

FI_fx(FI_interval, time)

A fixed-interval schedule where the next food is arranged at a fixed time since the last food was delivered.

poisson_VR_fx(VR_length, resps)

A variable-ratio schedule where the next food is arranged after a number of responses that is sampled from a Poisson distribution. The density is:

f(t; λ) = λ^t * e^-t / t!

where λ is the arranged ratio requirement. See rpois

FR_fx(FR_length, resps)

A fixed-ratio schedule where the next food is arranged at a fixed number of responses since the last food was delivered.

Make an event object from a event function

Use the make.event function to make a event object.

Usage

make.event( event_fx, name )

Arguments

event_fx

A function that represents the event of interest

name

A character vector specifying the name of your event object

Value

Returns a event object.

See Also

make.control for making DOR_control objects.

set.custom_elemental for setting custom elemental classes.

make.custom_elemental for making custom elemental objects.

e_show for the function that is called by the show method.

accessor_helpers for the helper functions used in the built-in DOR functions.

Examples

1
2
3
4
5
# Make a variable-interval schedule
# Look at the definition of the "true_VI_fx" event function
true_VI_fx
# Make a event object out of the "true_VI_fx" event function
vi_schedule = make.event( event_fx = true_VI_fx, name = "vi_schedule" )

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