Description Usage Arguments Value Examples
View source: R/extract_data-methods.R
Applied to an object of type stansim_simulation,
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_simulation'
extract_data(object, datasets = "all",
parameters = "all", estimates = "all", values = NULL,
param_expand = TRUE, ...)
|
object |
An object of S3 class stansim_simulation. |
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 | ## Not run:
# extract full dataset
extract_data(simulation)
# extract all parameter means, 2.5% & 97.5% percentiles
extract_data(simulation, estimates = c("2.5%", "mean", "97.5%"))
# extract all Rhat estimates greater than 1.1
extract_data(simulation, estimates = "Rhat",
values = function(x) x > 1.1)
# extract all "eta" parameters
extract_data(simulation, parameters = "eta")
# extract all "eta[1]" parameters
extract_data(simulation, parameters = "eta[1]",
param_expand = FALSE)
# extract all rows for dataset "data_file-12.rds"
extract_data(simulation, datasets = "data_file-12.rds")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.