transform_dc | R Documentation |
Transform one or more draws component objects into a new one by applying a function
transform_dc(..., fun, to.matrix = FALSE, labels = NULL)
... |
draws component object(s) of class |
fun |
a function to apply. This function should take as many arguments as there are input objects. The arguments can be arbitrarily named, but they are assumed to be in the same order as the input objects. The function should return a vector. |
to.matrix |
if |
labels |
optional labels for the output object. |
Either a matrix or a draws component object.
ex <- mcmcsae_example(n=50)
sampler <- create_sampler(ex$model, data=ex$dat)
sim <- MCMCsim(sampler, burnin=100, n.iter=300, thin=2, n.chain=4, store.all=TRUE)
summary(sim$v_sigma)
summary(transform_dc(sim$v_sigma, fun=function(x) x^2))
summary(transform_dc(sim$u, sim$u_sigma, fun=function(x1, x2) abs(x1)/x2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.