collect_indices: Collect polynomial constraints that characterize the...

View source: R/graph-functions.R

collect_indicesR Documentation

Collect polynomial constraints that characterize the semialgebraic variety of a given tree

Description

The polynomials are represented as a list of indices. Example: If one polynomial is \sigma_{pq} \sigma_{rs} - \sigma_{pr} \sigma_{qs} then the indices will be p,q,r,s,p,r,q,s.

Usage

collect_indices(g, m, nr_4 = NULL, nr_3 = NULL)

Arguments

g

An igraph object that is a tree. It is assumed that the first m nodes correspond to observed nodes.

m

Integer, number of observed nodes.

nr_4

Number of considered subsets of size 4. This is optional. If NULL, all subsets are considered. If a number is given, subsets are chosen randomly.

nr_3

Number of considered subsets of size 3. This is optional. If NULL, all subsets are considered. If a number is given, subsets are chosen randomly.

Value

A list with three entries is returned. All entries are matrices. The first matrix contains the equality constraints and has 8 columns. The second matrix contains all inequality constraints where only 6 indices are necessary (i.e. it has 6 columns). The third matrix contains the inequality constraints where 8 indices are necessary (i.e. it has 8 columns).

Examples

vertices <- data.frame(name=seq(1,8), type=c(rep(1,5), rep(2,3))) # 1=observed, 2=latent
edges <- data.frame(from=c(1,2,3,4,5,6,7), to=c(8,8,6,6,7,7,8))
tree <- igraph::graph_from_data_frame(edges, directed=FALSE, vertices=vertices)
plot(tree)
collect_indices(tree, 5)

NilsSturma/TestGGM documentation built on June 30, 2023, 3:09 p.m.