Applied to an object of type stansim_collection, extract_time_elapsed() will return the time taken to fit the models contained within the object a dataframe, subject to the filtering specified by the function arguments.

# S3 method for stansim_collection
extract_time_elapsed(object, sim_names = "all",
  datasets = "all", chains = "all", stages = "all", elapsed = NULL, ...)

Arguments

object

An object of S3 class stansim_collection.

sim_names

Either a character vector containing the names of the stansim_simulation objects grouped in the collection, or the string "all". The former will only return values for the corresponding simulations, the latter applies no filtering on stansim simulations.

datasets

Either a character vector containing the names of datasets (as provided to the original fit_models() calls) fitted, or the string "all". The former will only return values for the corresponding datasets, the latter applies no filtering on datasets

chains

Either a character vector containing the numbers of the stan model chains to return, or the string "all" The former will only return values for the corresponding chains, the latter applies no filtering on chains.

stages

Either a character vector containing the names of model fitting stages, c("warmup", "sample", "total"), or the string "all". The former will only return values for the corresponding stages, the latter applies no filtering on estimates.

elapsed

Either a function taking a single numeric argument that returns a Boolean value, or NULL. The former will only return elapsed times for which the provided function is TRUE, the latter applies no filtering on elapsed times

...

other arguments not used by this method

Value

A dataframe containing the specified data.

Examples

# NOT RUN {
# extract full dataset
extract_time_elapsed(simulation)

# extract all rows for dataset "data_file-12.rds"
extract_time_elapsed(simulation, datasets = "data_file-12.rds")

# extract results for chains 1 and 3
extract_time_elapsed(simulation, chains = c(1, 3))

# extract results for only the warmup stage
extract_time_elapsed(simulation, stages = "warmup")

# extract all elapsed times greater than 60 seconds
extract_time_elapsed(simulation,
                     elapsed = function(x) x > 60)
# }