Skip to contents

Returns either the models themselves or references to them.

Usage

model(sim, ..., subset = NULL, reference = FALSE)

Arguments

sim

a simulation object

...

logical conditions to specify a subset of models. Conditions can only involve params of model that have length 1 and are of class numeric or character.

subset

a vector of integers indexing the models or a vector of model names. To select models based on parameter values, use .... However, using ... is slower than using subset.

reference

whether to return the ModelRef or the Model object itself

Details

There are two main ways to specify a subset of the models. (1) The easiest way is by writing a conditional expression involving the parameters and passing it through .... For example, n > 100 & p <= 20. Only parameters that are length one and either numeric or character can be used in these expressions. (2) The faster way to retrieve a subset of models is to use the subset argument. This can be either a set of numerical values (specifying which models to load based on the order in which the models are stored in the simulation object. This order can be ascertained by printing the simulation object.) or as a set of a character vector of the model names desired.

While approach (1) is very convenient, it requires loading all models from file. This may be slow in situations in which there are a lot of models and/or the models are large and thus slow to load.