stanreg-draws-formats {rstanarm} | R Documentation |
Create a draws
object from a stanreg
object
Description
Convert a stanreg
object to a format supported by the
posterior package.
Usage
## S3 method for class 'stanreg'
as_draws(x, ...)
## S3 method for class 'stanreg'
as_draws_matrix(x, ...)
## S3 method for class 'stanreg'
as_draws_array(x, ...)
## S3 method for class 'stanreg'
as_draws_df(x, ...)
## S3 method for class 'stanreg'
as_draws_list(x, ...)
## S3 method for class 'stanreg'
as_draws_rvars(x, ...)
Arguments
x |
A |
... |
Arguments (e.g., |
Details
To subset iterations, chains, or draws, use
subset_draws
after making the
draws
object. To subset variables use ...
to pass the pars
and/or regex_pars
arguments to as.matrix.stanreg
or
as.array.stanreg
(these are called internally by
as_draws.stanreg
), or use
subset_draws
after making the
draws
object.
Value
A draws
object from the
posterior package. See the
posterior package documentation and vignettes for details on working
with these objects.
Examples
fit <- stan_glm(mpg ~ wt + as.factor(cyl), data = mtcars)
as_draws_matrix(fit) # matrix format combines all chains
as_draws_df(fit, regex_pars = "cyl")
posterior::summarize_draws(as_draws_array(fit))
[Package rstanarm version 2.32.1 Index]