subset_draws {posterior} | R Documentation |
draws
objectsSubset draws
objects by variables, iterations, chains, and draws indices.
subset_draws(x, ...) ## S3 method for class 'draws_matrix' subset_draws( x, variable = NULL, iteration = NULL, chain = NULL, draw = NULL, regex = FALSE, unique = TRUE, ... ) ## S3 method for class 'draws_array' subset_draws( x, variable = NULL, iteration = NULL, chain = NULL, draw = NULL, regex = FALSE, unique = TRUE, ... ) ## S3 method for class 'draws_df' subset_draws( x, variable = NULL, iteration = NULL, chain = NULL, draw = NULL, regex = FALSE, unique = TRUE, ... ) ## S3 method for class 'draws_list' subset_draws( x, variable = NULL, iteration = NULL, chain = NULL, draw = NULL, regex = FALSE, unique = TRUE, ... ) ## S3 method for class 'draws_rvars' subset_draws( x, variable = NULL, iteration = NULL, chain = NULL, draw = NULL, regex = FALSE, unique = TRUE, ... ) ## S3 method for class 'rvar' subset_draws(x, variable = NULL, ...) ## S3 method for class 'draws' subset(x, ...)
x |
(draws) A |
... |
Arguments passed to individual methods (if applicable). |
variable |
(character vector) The variables to select. All elements of non-scalar variables can be selected at once. |
iteration |
(integer vector) The iteration indices to select. |
chain |
(integer vector) The chain indices to select. |
draw |
(integer vector) The draw indices to be select. Subsetting draw
indices will lead to an automatic merging of chains via |
regex |
(logical) Should |
unique |
(logical) Should duplicated selection of chains, iterations, or
draws be allowed? If |
To ensure that multiple consecutive subsetting operations work correctly,
subset()
repairs the draws
object before and after
subsetting.
A draws
object of the same class as x
.
x <- example_draws() subset_draws(x, variable = c("mu", "tau")) subset_draws(x, chain = 2) subset_draws(x, iteration = 5:10, chain = 3:4) # extract the first chain twice subset_draws(x, chain = c(1, 1), unique = FALSE) # extract all elements of 'theta' subset_draws(x, variable = "theta")