markov: Compute a Markov Basis with 4ti2

Description Usage Arguments Value References Examples

View source: R/markov.r

Description

A Markov basis of a matrix A is computed with the markov function of 4ti2, obtained with the LattE-integrale bundle.

Usage

1
2
markov(mat, format = c("mat", "vec", "tab"), dim = NULL, all = FALSE,
  dir = tempdir(), opts = "-parb", quiet = TRUE, dbName)

Arguments

mat

a matrix; for example the output of hmat

format

how the moves should be returned (if "mat", moves are columns)

dim

the dimension to be used in vec2tab if format = "tab" is used, oftentimes a vector of the number of levels of each variable in order

all

if TRUE, all moves (+ and -) are given. if FALSE, only the + moves are given.

dir

directory to place the files in, without an ending /

opts

options for markov

quiet

show 4ti2 output

dbName

the name of the model in the markov bases database, http://markov-bases.de, see examples

Value

a matrix containing the Markov basis as its columns (for easy addition to tables)

References

Drton, M., B. Sturmfels, and S. Sullivant (2009). Lectures on Algebraic Statistics, Basel: Birkhauser Verlag AG.

Examples

 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
## Not run: 




# 2x2 independence example
# following convention, the first index indicates rows
varlvls <- c(2,2)
facets <- list(1,2)
( A <- hmat(varlvls, facets) )
markov(A)
markov(A, "vec")
markov(A, "tab", varlvls)
markov(A, "tab", varlvls, TRUE)




# 3x3 independence example
# following convention, the first index indicates rows
varlvls <- c(3,3)
facets <- list(1,2)
( A <- hmat(varlvls, facets) )
markov(A)
markov(A, "vec")
markov(A, "tab", varlvls)
markov(A, "tab", varlvls, TRUE)




# LAS example 1.2.1, p.12 (2x3 independence)
varlvls <- c(2,3)
facets <- list(1, 2)
( A <- hmat(varlvls, facets) )
markov(A, "tab", varlvls)
# Prop 1.2.2 says that there should be
2*choose(2, 2)*choose(3,2) # = 6
# moves.
markov(A, "tab", varlvls, TRUE)





# LAS example 1.2.12, p.17  (no 3-way interaction)
varlvls <- c(2,2,2)
facets <- list(c(1,2), c(1,3), c(2,3))
( A <- hmat(varlvls, facets) )
markov(A)






# LAS example 1.2.12, p.16  (no 3-way interaction)
varlvls <- c(2,2,2,2)
facets <- list(c(1,2), c(1,4), c(2,3))
( A <- hmat(varlvls, facets) )
markov(A)
markov(A, "tab", varlvls) # hard to understand
tableau(markov(A), varlvls)










# using the markov bases database, must be connected to internet
# A <- markov(dbName = "ind3-3")
B <- markov(hmat(c(3,3), list(1,2)))
# all(A == B)












markov(diag(1, 10))


## End(Not run)

algstat documentation built on May 29, 2017, 10:34 p.m.

Related to markov in algstat...