stanreg-draws-formats | R Documentation |
draws
object from a stanreg
objectConvert a stanreg
object to a format supported by the
posterior package.
## 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, ...)
x |
A |
... |
Arguments (e.g., |
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.
A draws
object from the
posterior package. See the
posterior package documentation and vignettes for details on working
with these objects.
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.