structmcmc: The structmcmc package.

Description See Also Examples

Description

The structmcmc package.

See Also

posterior

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Setup data frame
x1 <- factor(c("a", "a", "g", "c", "c", "a", "g", "a", "a"))
x2 <- factor(c(2, 2, 4, 3, 1, 4, 4, 4, 1))
x3 <- factor(c(FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE))
x <- data.frame(x1 = x1, x2 = x2, x3 = x3)

# Draw samples from the posterior using MC^3.
set.seed(1234)
mcmc <- posterior(data = x, method = "mh-mcmc",
                  nSamples = 1000, nBurnin = 100)

# Compute and plot estimated edge probabilities
epmcmc <- ep(mcmc)

# Exact evaluation by exhaustive enumeration
exact <- posterior(x, "exact")
epexact <- ep(exact)

# Comparing multiple MCMC runs
mcmc2 <- posterior(x, "mh-mcmc", nSamples = 1000, nBurnin = 100)
epmcmc2 <- ep(mcmc2)

rjbgoudie/structmcmc documentation built on Nov. 3, 2020, 3:41 a.m.