Description Usage Details Slots Set a custom model class Make a custom model model See Also Examples
model objects are used for implementing computational models in the CAB package. The general implementation of a model is that the model class is a parent class. A specific computational model, such as Catania's Operant Reserve (model.COR) is then a child class that inherits slots from the parent model class. An object of a child model class contains all the control objects that are nedded for the model to run. See model.COR for an example.
1 2 3 | set.custom_model(control_objs, model_class_name)
make.custom_model(..., input, model_class)
|
A model object contains all of the control objects for all of the elemental objects that are required to implement a given model. Hence, the model object for a given model will contain all of the necessary functions and parameters as well as an iterator which is a design matrix out of all of the parameter levels across each control object. Although it is up to the user to define which control objects the model object contains, there are some slots that are mandatory (e.g. the iterator that controls the conditions that are run). The mandatory slots are documented here.
control_listA list of the control object names.
enumerated_conditionsA list of the conditions coded as numbers.
iteratorA data frame that stores the condition information.
model classTo set a custom model class:
set.custom_model( control_objs, model_obj_name )
control_objsA character string giving the name of the control classes in a model. See class.control for setting and making custom control classes/objects.
model_class_nameA character string specifying the name of the model.
Sets a model object. If there were no errors, a message will be printed stating that the model class has been set.
model modelTo set a custom model object:
make.custom_model( ..., input, model_class )
...A collection of control objects that belong to the model. It is best to name each argument. See example.
inputA input object containing all the required inputs for the model.
model_classA character string giving the name of the model class.
set.custom_elemental For setting and making custom elemental objects.
class.control For setting and making custom control objects.
class.input For the input class.
model.COR For an example of an implemented model.
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 | # Set a custom model object
# First, set some custom elemental objects
set.custom_elemental( "test_elemental1" )
set.custom_elemental( "test_elemental2" )
# Make the custom elemental objects.
test_element1 = make.custom_elemental( function(a, time){a}, "test_element1", "test_elemental1" )
test_element2 = make.custom_elemental( function(a, time){a}, "test_element2", "test_elemental2" )
#Make a 'time' input
time_input = make.input( "time_input" )
test_input = make.input( time_input )
# Set up custom control class
set.custom_control( "test_elemental1" )
set.custom_control( "test_elemental2" )
# Note the names of the control objects are "test_elemental1_control" and "test_elemental2_control"
# Set up parameters
test1_param = list( a = 1, time = "time_input" )
test2_param = list( a = 3, time = "time_input" )
#Make control objects
test1_ctrl = make.control( test_element1, test1_param )
test2_ctrl = make.control( test_element2, test2_param )
# Set up the custom class
set.custom_model( c("test_elemental1_control", "test_elemental2_control" ) ,model_class_name = "test_model" )
# Make a 'test_model" object
test_model = make.custom_model( test_elemental1_control = test1_ctrl, test_elemental2_control = test2_ctrl, input = test_input, model_class = "test_model" )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.