
Last chance! 50% off unlimited learning
Sale ends in
Select a subset of chains, samples and parameters from a draws component (dc) object
# S3 method for dc
subset(
x,
chains = seq_len(nchains(x)),
draws = seq_len(ndraws(x)),
vars = seq_len(nvars(x)),
...
)
The selected part of the draws component as an object of class dc
.
a draws component (dc) object.
an integer vector indicating which chains to select.
an integer vector indicating which samples to select.
an integer vector indicating which parameters to select.
not used.
n <- 300
dat <- data.frame(x=runif(n), f=as.factor(sample(1:7, 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)
sim <- MCMCsim(sampler)
(summary(sim$beta))
(summary(subset(sim$beta, chains=1)))
(summary(subset(sim$beta, chains=1, draws=sample(1:ndraws(sim), 100))))
(summary(subset(sim$beta, vars=1:2)))
Run the code above in your browser using DataLab