Get one or more draws from a simulation

Share:

Description

Returns either the draws objects themselves or references to them. See model function for more information on the ... and subset arguments, which are used to specify a subset of the models.

Usage

1
draws(sim, ..., subset = NULL, index, 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.

index

a vector of positive integers specifying which draws objects are desired. If missing, then all draws' outputs are returned.

reference

whether to return the ModelRef or the Model object itself

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
 # suppose previously we had run the following:
 sim <- new_simulation(name = "normal-example",
                       label = "Normal Mean Estimation",
                       dir = tempdir()) %>%
   generate_model(make_my_example_model, n = 20) %>%
   simulate_from_model(nsim = 50, index = 1:3)
 # then we could get the simulated draws as follows:
 d <- draws(sim)
 d@draws$r1.1 # first random draw
 
## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.