Description Usage Arguments Value Examples
View source: R/extract_data-methods.R
Applied to an object of type stansim_collection,
extract_data()
will return the object's simulation data as a
dataframe, subject to the filtering specified by the function arguments.
1 2 3 4 | ## S3 method for class 'stansim_collection'
extract_data(object, sim_names = "all",
datasets = "all", parameters = "all", estimates = "all",
values = NULL, param_expand = TRUE, ...)
|
object |
An object of S3 class stansim_collection. |
sim_names |
Either a character vector containing the names of the
|
datasets |
Either a character vector containing the names of datasets
(as provided to the original |
parameters |
Either a character vector containing the names of stan
model parameters present in the fitted stan models, or the string
|
estimates |
Either a character vector containing the names of parameter
estimates calculated (e.g. c("2.5
|
values |
Either a function taking a single numeric argument that returns
a Boolean value, or |
param_expand |
If |
... |
other arguments not used by this method |
A dataframe containing the specified data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Not run:
# extract full dataset
extract_data(collection)
# extract all parameter means, 2.5% & 97.5% percentiles
extract_data(collection, estimates = c("2.5%", "mean", "97.5%"))
# extract all Rhat estimates greater than 1.1
extract_data(collection, estimates = "Rhat",
values = function(x) x > 1.1)
# extract all "eta" parameters
extract_data(collection, parameters = "eta")
# extract all "eta[1]" parameters
extract_data(collection, parameters = "eta[1]",
param_expand = FALSE)
# extract all rows for dataset "data_file-12.rds"
extract_data(collection, datasets = "data_file-12.rds")
# extract all rows for sim_names "simulation1"
extract_data(collection, sim_names = "simulation1")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.