read_draws {mcmcsae} | R Documentation |
Read MCMC draws from a file
Description
Read draws written to file by MCMCsim
used with argument to.file
.
Usage
read_draws(name, filename = paste0("MCdraws_", name, ".dat"))
Arguments
name |
name of the parameter to load the corresponding file with posterior draws for. |
filename |
name of the file in which the draws are stored. |
Value
An object of class dc
containing MCMC draws for a (vector) parameter.
Examples
## Not run:
# NB this example creates a file "MCdraws_e_.dat" in the working directory
n <- 100
dat <- data.frame(x=runif(n), f=as.factor(sample(1:5, n, replace=TRUE)))
gd <- generate_data(~ reg(~ x + f, prior=pr_normal(precision=1), name="beta"), data=dat)
dat$y <- gd$y
sampler <- create_sampler(y ~ reg(~ x + f, name="beta"), data=dat)
# run the MCMC simulation and write draws of residuals to file:
sim <- MCMCsim(sampler, n.iter=500, to.file="e_")
summary(sim)
mcres <- read_draws("e_")
summary(mcres)
## End(Not run)
[Package mcmcsae version 0.7.7 Index]