| post_bind {postpack} | R Documentation |
Combine two objects containing posterior samples
Description
Intended for use when derived quantities are calculated from monitored posterior samples,
and you wish to combine them into the master mcmc.list,
as though they were calculated and monitored during MCMC sampling.
It is not advised to combine samples from two MCMC runs, because covariance
of MCMC sampling would be lost.
Usage
post_bind(post1, post2, dup_id = "_p2")
Arguments
post1 |
|
post2 |
|
dup_id |
If any node names are duplicated in |
Details
Some important things to note:
If the object passed to
post1is amatrix,post2must be amcmc.list, and vice versa.That is, two
mcmc.listobjects are allowed, but not twomatrixobjects.For
matrixobjects, nodes should be stored as columns and samples should be stored as rows. Column names should be present.The objects passed to
post1andpost2must have the same number of chains, iterations, burnin, and thinning interval.If the node names are empty (e.g., missing column names in a
matrix), the node names will be coerced to"var1","var2", etc. and a warning will be returned.
Value
A single mcmc.list object containing samples of the nodes from both post1 and post2.
Examples
# load example mcmc.list
data(cjs)
# create two subsets from cjs: one as mcmc.list and one as matrix
# also works if both are mcmc.list objects
p1 = post_subset(cjs, "b0")
p2 = post_subset(cjs, "b1", matrix = TRUE)
# combine them into one mcmc.list
head(post_bind(p1, p2))