extract_time_elapsed.stansim_simulation: Extract time_elapsed from a stansim_simulation object

Description Usage Arguments Value Examples

View source: R/extract_time_elapsed-methods.R

Description

Applied to an object of type stansim_simulation, 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.

Usage

1
2
3
## S3 method for class 'stansim_simulation'
extract_time_elapsed(object, datasets = "all",
  chains = "all", stages = "all", elapsed = NULL, ...)

Arguments

object

An object of S3 class stansim_simulation.

datasets

Either a character vector containing the names of datasets (as provided to the original fit_models() call) 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## 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)

## End(Not run)

Ewan-Keith/rstansim documentation built on May 6, 2019, 4:08 p.m.