MC3: Implementation of the MC3 algorithm

Description Usage Arguments Value Author(s) References Examples

Description

The MC3 algorithm is used to find the log-linear models with the highest posterior probability. The function is capable of searching the space of decomposable, graphical, and hierarchical models.

Usage

1
2
MC3 (init = NULL, alpha = 1, iterations = 5000, replicates = 1, data, 
            mode = c("Hierarchical", "Graphical", "Decomposable")) 

Arguments

init

A starting list of models for the MOSS algorithm. If not NULL, this list should consist of R formulas.

alpha

The value of the hyperparameter alpha.

iterations

Number of iterations of the MC3 algorithm

replicates

The number of instances the MC3 algorithm will be run. The top models are culled from the results of all the replicates.

data

A data frame containing the contingency table. All cells must be included in data and the last column must be the cell counts. The number of variables in the contingency table must be at least 3.

mode

The scope of the loglinear model search. The search can be over the space of decomposable, graphical, or hierarchical models.

Value

A data frame with the top models found and their log posterior probability up to a constant.

Author(s)

Matthew Friedlander

References

see vignette

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(czech)
s1 <- MC3 (init = NULL, alpha = 1, iterations = 5, 
            replicates = 1, data = czech, 
            mode = "Decomposable")
s2 <- MC3 (init = NULL, alpha = 1, iterations = 5, 
            replicates = 1, data = czech, 
            mode = "Graphical")
s3 <- MC3 (init = NULL, alpha = 1, iterations = 5, 
            replicates = 1, data = czech, 
            mode = "Hierarchical")

Example output

Loading required package: igraph

Attaching package: 'igraph'

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union


replicate [1], iteration [1].
proposal model = [a,b][c][d][e][f]
proposal logPostProb = 4915.94
proposal accepted
rejection rate =  0

replicate [1], iteration [2].
proposal model = [a,b][c][d][e,f]
proposal logPostProb = 4913.5
proposal rejected
rejection rate =  0.33

replicate [1], iteration [3].
proposal model = [a,b][c][d][e,f]
proposal logPostProb = 4913.5
proposal rejected
rejection rate =  0.5

replicate [1], iteration [4].
proposal model = [a,b][a,d][c][e][f]
proposal logPostProb = 4917.16
proposal accepted
rejection rate =  0.4

replicate [1], iteration [5].
proposal model = [a,b,d][c][e][f]
proposal logPostProb = 4908.88
proposal rejected
rejection rate =  0.5

replicate [1], iteration [1].
proposal model = [a,b][c,e][d][e,f]
proposal logPostProb = 6761.64
proposal accepted
rejection rate =  0

replicate [1], iteration [2].
proposal model = [a][b][c,e][d][e,f]
proposal logPostProb = 6760.55
proposal rejected
rejection rate =  0.33

replicate [1], iteration [3].
proposal model = [a,b][a,c][c,e][d][e,f]
proposal logPostProb = 6771.63
proposal accepted
rejection rate =  0.25

replicate [1], iteration [4].
proposal model = [a,b][a,c][d][e,f]
proposal logPostProb = 6767.04
proposal rejected
rejection rate =  0.4


[1] 13.34827
[1] 6751.497
replicate [1], iteration [1].
proposal model = [a,f][b,d][c][e]
proposal logPostProb = 6751.5
proposal rejected
rejection rate =  0.5

[1] 6751.338
replicate [1], iteration [2].
proposal model = [a,f][b,d][c][d,e][d,f]
proposal logPostProb = 6751.34
proposal rejected
rejection rate =  0.67

[1] 6755.939
replicate [1], iteration [3].
proposal model = [a,d][a,f][b,d][c][d,e]
proposal logPostProb = 6755.94
proposal accepted
rejection rate =  0.5

[1] 6754.917
replicate [1], iteration [4].
proposal model = [a,d][a,f][b,d][b,f][c][d,e]
proposal logPostProb = 6754.92
proposal rejected
rejection rate =  0.6

bayesloglin documentation built on May 1, 2019, 9:45 p.m.