Learn R Programming

mcmcsae (version 0.6.0)

subset.dc: Select a subset of chains, samples and parameters from a draws component

Description

Select a subset of chains, samples and parameters from a draws component

Usage

# S3 method for dc
subset(
  x,
  chains = seq_len(nchains(x)),
  draws = seq_len(ndraws(x)),
  vars = seq_len(nvars(x)),
  ...
)

Arguments

x

a draws component object.

chains

an integer vector indicating which chains to select.

draws

an integer vector indicating which samples to select.

vars

an integer vector indicating which parameters to select.

...

not used.

Value

The selected part of the draws component as an object of class dc.

Examples

Run this code
# NOT RUN {
n <- 300
dat <- data.frame(x=runif(n), f=as.factor(sample(1:7, n, replace=TRUE)))
gd <- generate_data(~ reg(~ x + f, Q0=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