| PickStuck | R Documentation |
Calculate each chain separately for the mean (across many MCMC iterations)
of posterior log-likelihood. If the difference of the means and
the median (across chains) of the mean of posterior is greater than the
cut, chains are considered stuck. The default value for cut
is 10. unstick manually removes stuck chains from posterior samples.
PickStuck(
x,
hyper = FALSE,
cut = 10,
start = 1,
end = NA,
verbose = FALSE,
digits = 2
)
x |
posterior samples |
hyper |
whether x are hierarhcial samples |
cut |
a criterion deciding if a chain is stuck. |
start |
start to evaluate from which iteration. |
end |
end at which iteration for evaeuation. |
verbose |
a boolean switch to print more information |
digits |
print how many digits. Default is 2 |
PickStuck gives an index vector; unstick gives a DMC
sample.
model <- BuildModel(
p.map = list(A = "1", B = "1", t0 = "1", mean_v = "M", sd_v = "1", st0 = "1"),
match.map = list(M = list(s1 = 1, s2 = 2)),
factors = list(S = c("s1", "s2")),
constants = c(st0 = 0, sd_v = 1),
responses = c("r1", "r2"),
type = "norm")
p.vector <- c(A = .75, B = .25, t0 = .2, mean_v.true = 2.5, mean_v.false = 1.5)
p.prior <- BuildPrior(
dists = c("tnorm", "tnorm", "beta", "tnorm", "tnorm"),
p1 = c(A = .3, B = .3, t0 = 1, mean_v.true = 1, mean_v.false = 0),
p2 = c(1, 1, 1, 3, 3),
lower = c(0, 0, 0, NA, NA),
upper = c(NA,NA, 1, NA, NA))
## Not run:
dat <- simulate(model, 30, ps = p.vector)
dmi <- BuildDMI(dat, model)
sam <- run(StartNewsamples(dmi, p.prior))
bad <- PickStuck(sam)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.