View source: R/gather-spread.R
spread_sims | R Documentation |
spread_sims()
returns a wide-format data frame. gather_sims()
returns a
long-format data frame. The format matches the format in the tidybayes
spread_draws()
and gather_draws()
functions.
spread_sims(object, nsim = 200, n_sims = deprecated())
gather_sims(object, nsim = 200, n_sims = deprecated())
object |
Output from |
nsim |
The number of simulation draws. |
n_sims |
Deprecated: please use |
A data frame. gather_sims()
returns a long-format data frame:
.iteration
: the sample ID
.variable
: the parameter name
.value
: the parameter sample value
spread_sims()
returns a wide-format data frame:
.iteration
: the sample ID
columns for each parameter with a sample per row
m <- sdmTMB(density ~ depth_scaled,
data = pcod_2011, mesh = pcod_mesh_2011, family = tweedie())
head(spread_sims(m, nsim = 10))
head(gather_sims(m, nsim = 10))
samps <- gather_sims(m, nsim = 1000)
if (require("ggplot2", quietly = TRUE)) {
ggplot(samps, aes(.value)) + geom_histogram() +
facet_wrap(~.variable, scales = "free_x")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.