View source: R/helpful.functions.R
add.mcmc | R Documentation |
This is a convenient function to add results (i.e. combine mcmc.list). This can be useful when combining results obtained from multiple imputation
add.mcmc(x, y)
x |
first result in a format of mcmc.list |
y |
second result in a format of mcmc.list |
ds <- generate_ipdma_example(type = "continuous") ds2 <- generate_ipdma_example(type = "continuous") ipd <- with(ds, ipdma.model.onestage(y = y, study = studyid, treat = treat, X = cbind(z1, z2), response = "normal", shrinkage = "none")) ipd2 <- with(ds2, ipdma.model.onestage(y = y, study = studyid, treat = treat, X = cbind(z1, z2), response = "normal", shrinkage = "none")) samples <- ipd.run(ipd, pars.save = c("beta", "gamma", "delta"), n.chains = 3, n.burnin = 500, n.iter = 5000) samples2 <- ipd.run(ipd2, pars.save = c("beta", "gamma", "delta"), n.chains = 3, n.burnin = 500, n.iter = 5000) combined <- add.mcmc(samples, samples2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.