simGibbs {netchain} | R Documentation |
Generate binary (Y, A, C) from chain graph model under simplest scenario.
simGibbs(n.unit, n.gibbs, n.sample, weight.matrix, treat.matrix, cov.matrix, init.prob = 0.5, treat.prob = 0.5, cov.prob = 0.5, n.burn = 100, yvalues = c(1, 0))
n.unit |
the number of units ( |
n.gibbs |
the number of independent Gibbs sampler. |
n.sample |
the number of samples from each Gibbs sampling ( |
weight.matrix |
a |
treat.matrix |
a |
cov.matrix |
a |
init.prob |
an initial probability generating (Y, A, C) from Bernoulli distribution. |
treat.prob |
a probability updating A in Gibbs sampling procedure. |
cov.prob |
a probability updating C in Gibbs sampling procedure. |
n.burn |
the number of burn-in sample in Gibbs sampling (≥ |
yvalues |
a vector of distinct binary outcome values. Defaults to |
a list of [n.gibbs] x [n.sample]
independent observations:
|
a |
|
a |
|
a |
library(netchain) weight.matrix <- matrix(c(0.5, 1, 0, 1, 0.3, 0.5, 0, 0.5, -0.5), 3, 3) simobs <- simGibbs(n.unit = 3, n.gibbs = 200, n.sample = 10, weight.matrix, treat.matrix = 0.5*diag(3), cov.matrix= (-0.3)*diag(3) ) inputY <- simobs$inputY inputA <- simobs$inputA inputC <- simobs$inputC