findQ: Determine the set Q

View source: R/graph-functions.R

findQR Documentation

Determine the set Q

Description

For all subsets of size 4 of the observed nodes of a tree, the function determines if a subset is an element of Q or not.

Usage

findQ(g, m, nr = 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

Integer, number of subsets that are considered. Note that this is optional. If NULL, all subsets are considered.

Value

A list with two entries is returned. Both entries are matrices with 4 columns. The first matrix are all subsets that belong to Q, the second are all subsets that do not belong to Q. Each row represents one subset. For the matrix Q the order of the elements in a row is important. A row with entries p,q,r,s means that the element p,q|r,s is in Q.

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)
findQ(tree, 5)

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