-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLikelihoodGeometry.m2
More file actions
111 lines (96 loc) · 3.37 KB
/
Copy pathLikelihoodGeometry.m2
File metadata and controls
111 lines (96 loc) · 3.37 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---------------------------------------------------------------------------
-- PURPOSE : Create methods for computing facts relating to likelihood geometry -- of discrete statistical models.
--
-- PROGRAMMERS : Dave Barnhill, John Cobb, Matthew Faust
--
-- UPDATE HISTORY : created 7 September 2023 as a part of the IMSI workshop -- -- "Algebraic Statistics";
---------------------------------------------------------------------------
newPackage("LikelihoodGeometry",
AuxiliaryFiles => true,
Version => "0.1",
Date => "4 September 2024",
Authors => {
{Name => "John Cobb", Email => "jdcobb3@gmail.com", HomePage => "https://johndcobb.github.io"},
{Name => "Matthew Faust", Email => "mfaust@msu.edu", HomePage => "https://mattfaust.github.io"},
{Name => "David Barnhill", Email => "barnhill@usna.edu", HomePage => "https://scholar.google.com/citations?user=0PLXk0AAAAAJ&hl=en"}
},
Headline => "Methods for computing likelihood geometry of discrete statistical models",
Keywords => {"Commutative Algebra, Algebraic Statistics, Discrete Statistical Models, Likelihood Geometry"},
PackageExports => {"Graphs", "LLLBases", "FourTiTwo"},
PackageImports => {"Elimination", "NormalToricVarieties"},
DebuggingMode => true --turn to false when submitting
)
export{
-- Types
"DiscreteRandomVariable",
-- Functions/Methods
"discreteRandomVariable",
"LCRing",
"computeLC",
"toricModel",
"toricIdeal",
"states",
"mean",
"sample",
"variance",
"MLdegree",
"toricPolytope",
-- Constructions
"rationalNormalScroll",
"makeLogLinearMatrix"
-- Symbols
-- Helper functions
}
protect pmf
baseDirectory = LikelihoodGeometry#"source directory"
--------------------------------------------------------------------
----- CODE
--------------------------------------------------------------------
load(baseDirectory | "LikelihoodGeometry/Code.m2")
--- THINGS TO IMPLEMENT? --
-*
*-
--------------------------------------------------------------------
----- DOCUMENTATION
--------------------------------------------------------------------
beginDocumentation()
load(baseDirectory | "LikelihoodGeometry/Documentation.m2")
--------------------------------------------------------------------
----- TESTS
--------------------------------------------------------------------
load(baseDirectory | "LikelihoodGeometry/Tests.m2")
end
--------------------------------------------------------------------
----- SCRATCH SPACE
--------------------------------------------------------------------
uninstallPackage "LikelihoodGeometry";
restart
debug installPackage "LikelihoodGeometry"
--check LikelihoodGeometryf
debug needsPackage "LikelihoodGeometry";
a = discreteRandomVariable 2;
b = discreteRandomVariable 3;
c = discreteRandomVariable 4;
G = graph({{a,b}, {b,c}})
X = toricModel G
Mlist = computeLCJI(X)
I = computeLCJI(X)
J = computeLC(X)
R = ring(I)
S = ring(J)
a = discreteRandomVariable 2;
b = discreteRandomVariable 2;
c = discreteRandomVariable 2;
S = {{a,b}, {b,c}};
L = {a,b,c};
makeLogLinearMatrix(S,L)
LCRing(toricModel G)
phi = map(R,S, vars R)
phi(J) == I
maxCliques = findMaximalCliques G
states maxCliques
makeLogLinearMatrix(maxCliques, vertices G)
S = rationalNormalScroll({1,2,3})
G = graph({1,2,3,4,5,6},{{2,3}, {4,5}, {5,6}, {6,4}})
C = connectedComponents G
isJointlyIndependent(G)