Description Usage Arguments Value Note Alternative
Extract parameters from a single draw
1 | extract_parameters_from_draw(fit, param, draw)
|
fit |
Stanfit object. |
param |
Vector of parameter names. |
draw |
Index of the draw to extract the parameters from. |
Dataframe
Useful for to generate fake data.
The 'tidybayes' package offers an alternative to this function, for example:
fit %>% tidy_draws() %>% gather_variables() %>% filter(.draw == draw & .variable %in% param)
However, the 'tidybayes' version is less efficient as all draws and parameters are extracted and then filtered (also the draw IDs are not the same).
Using 'tidybayes' would be more recommended when we only want to extract specific parameters,
and that it does not matter which draw are extracted (in that case using tidybayes::spread_draws()
).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.