View source: R/extract_draws.R
| gather_draws | R Documentation |
Useful to convert MCMC chain draws of particular parameters or output from the model object to a long format for further data wrangling
gather_draws(mod, ..., transformed = F)
mod |
An object of class "plm0", "plm", "gplm0" or "gplm". |
... |
Any number of character vectors containing valid names of parameters in the model or "rating_curve" and "rating_curve_mean". Also accepts "latent_parameters" and "hyperparameters". |
transformed |
A boolean value determining whether the parameter is to be represented on the transformed scale used for sampling in the MCMC chain or the original scale. Defaults to FALSE. |
A data frame with columns:
chainThe chain number.
iterThe iteration number.
paramThe parameter name.
valueThe parameter value.
Hrafnkelsson, B., Sigurdarson, H., Rögnvaldsson, S., Jansson, A. Ö., Vias, R. D., and Gardarsson, S. M. (2022). Generalization of the power-law rating curve using hydrodynamic theory and Bayesian hierarchical modeling, Environmetrics, 33(2):e2711. doi: https://doi.org/10.1002/env.2711
plm0, plm, gplm0, gplm for further information on parameters
data(krokfors)
set.seed(1)
plm0.fit <- plm0(formula=Q~W,data=krokfors,num_cores=2)
hyp_samples <- gather_draws(plm0.fit,'hyperparameters')
head(hyp_samples)
rating_curve_samples <- gather_draws(plm0.fit,'rating_curve','rating_curve_mean')
head(rating_curve_samples)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.