make.sim_functions: Make simulation functions (closures)

Description Usage Arguments Format Details Slots See Also Examples

Description

Makes a closure from the functions specified in the elemental objects for a model and the parameters in the respective control objects. Specifically, the closure is implemented as its own class.

Usage

1
2
3
4
5

Arguments

conditions

A list of conditions. See get.model_conditions for a nice way to specify this argument.

model_object

A model object.

Format

In R, closures are shown with the code with which they were defined. Hence, the actual information that is contained in the closure will not be shown. Here, we have a special show function that shows the elemental function as well as the associated parameters in the closure. As with all show functions in CAB, the user is able to remove the show method with remove.show.element_fx_closure() and reinstate it with show.closure.helper.

Details

A closure is a function that contains some variables with some set values, i.e., the function closes over these variables. In the CAB package, the simulation of a model is done by creating closures using the functions that are specified in the elemental objects and with parameters that have been specified in the control objects. That is, each time a model is run with some parameters, each of the functions that are required to run the model are closed over the conditions for that particular combination of parameters.

Slots

element_fx

The elemental function.

condition_info

The parameters from the control object.

closure

The closure.

See Also

class.model.COR For the example.

get.model_conditions Where get.model_conditions is a nice way to specify the conditions argument for make.sim_functions.

do.sim_fx For calling the functions made by make.sim_functions.

Examples

1
2
3
# Following from the example in ?get.model_conditions
cond1 = get.model_conditions( my_COR, 1 )
my_sim_closures = make.sim_functions( cond1, my_COR )

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