Description Usage Arguments Examples
h.run.dmc
calls run_data
in the case of fixed-effect model, or
run_hyper
in the case of random-effect model. At the moment, it fits
either fixed-effect or random-effect model by looking for the
hyper
attribute in a DMC sample/object.
1 2 3 |
samples |
a DMC samples, usually generated by calling
|
report |
the progress report. Default is every 100 iterations report once |
cores |
a switch for parallel computation. In the case of fixed-effect
model, |
blocks |
a DEMCMC parameter for blocking. Not implemented yet. Default is NA |
p.migrate |
the probability of applying migration sampler. Set it
greater than will trigger the migration sampler. For example
|
h.p.migrate |
similar to p.migrate for hyper level |
force.hyper |
This argument has no funciton. It is here only for compatibility (with DMC) reason. |
force.data |
This argument has no funciton. It is here only for compatibility (with DMC) reason. |
gamma.mult |
a DE-MCMC tuning parameter, affecting the size of jump. Default is 2.38. |
h.gamma.mult |
Similar with gamm.mult. This argument has no funciton. It is here only for compatibility reason. |
setting |
a list to store setting arguments, such as p.migrate, gamma.mult, etc, sending to C++ function. The user should not use this argument |
verbose |
a swtich to see debugging information |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | m1 <- model.dmc(
p.map = list(a="1",v="1",z="1",d="1",sz="1",sv="1",t0="1",st0="1"),
match.map = list(M=list(s1="r1", s2="r2")),
factors = list(S=c("s1", "s2")),
constants = c(st0=0, d=0),
responses = c("r1","r2"),
type = "rd")
## Population distribution
pop.prior <- prior.p.dmc(
dists = rep("tnorm", 6),
p1 = c(a=2, v=2.5, z=.5, sz=.3, sv=1, t0=.3),
p2 = c(a=.5, v=.5, z=.1, sz=.1, sv=.3, t0=.05),
lower = c(0,-5, 0, 0, 0, 0),
upper = c(5, 7, 2, 2, 2, 2))
dat <- h.simulate.dmc(m1, nsim=30, p.prior=pop.prior, ns=8)
mdi <- data.model.dmc(dat, m1)
p.prior <- prior.p.dmc(
dists = rep("tnorm", 6),
p1 = c(a=2, v=2.5, z=.5, sz=.3, sv=1, t0=.3),
p2 = c(a=.5, v=.5, z=.1, sz=.1, sv=.3, t0=.05) * 5,
lower = c(0,-5, 0, 0, 0, 0),
upper = c(5, 7, 2, 2, 2, 2))
## Fixed-effect model
samplesInit <- h.samples.dmc(nmc=20, p.prior=p.prior, data=mdi, thin=1)
samples0 <- h.run.dmc(samples=samplesInit, report=10)
## Make a hyper-prior list
mu.prior <- prior.p.dmc(
dists = rep("tnorm", 6),
p1 = c(a=2, v=2.5, z=.5, sz=.3, sv=1, t0=.3),
p2 = c(a=.5, v=.5, z=.1, sz=.1, sv=.3, t0=.05) * 5,
lower = c(0,-5, 0, 0, 0, 0),
upper = c(5, 7, 2, 2, 2, 2))
sigma.prior <- prior.p.dmc(
dists = rep("beta", 6),
p1 = c(a=1, v=1, z=1, sz=1, sv=1, t0=1),
p2 = c(1,1,1,1,1,1),
upper = c(2,2,2,2,2,2))
pp.prior <- list(mu.prior, sigma.prior)
## Random-effect model
hsamplesInit <- h.samples.dmc(nmc=20, p.prior=p.prior, pp.prior=pp.prior,
data=mdi, thin=1)
hsamples0 <- h.run.dmc(samples=hsamplesInit, report=10, p.migrate=.05,
h.p.migrate=.05)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.