Marginalize and/or condition on variables in an ancestral graph (AG)
Source:R/operations.R
condition_marginalize.RdMarginalize variables out of an AG, and/or condition on variables. Depending on the structure, it could produce a graph with directed, bidirected, and undirected edges.
References
Definition 4.2.1 in Thomas Richardson. Peter Spirtes. "Ancestral graph Markov models." Ann. Statist. 30 (4) 962 - 1030, August 2002. doi:10.1214/aos/1031689015
See also
Other operations:
dag_from_pdag(),
exogenize(),
latent_project(),
meek_closure(),
moralize(),
mutate_caugi(),
normalize_latent_structure(),
skeleton()
Examples
mg <- caugi(
U %-->% X + Y,
A %-->% X,
B %-->% Y,
class = "DAG"
)
condition_marginalize(mg, marg_vars = "U") # ADMG
#> <caugi object; 4 nodes, 3 edges; simple: TRUE; session=0x555e2abe1880>
#> graph_class: AG
#> nodes: A, B, X, Y
#> edges: A-->X, B-->Y, X<->Y
condition_marginalize(mg, cond_vars = "U") # DAG
#> <caugi object; 4 nodes, 2 edges; simple: TRUE; session=0x555e32fb0d50>
#> graph_class: AG
#> nodes: A, B, X, Y
#> edges: A-->X, B-->Y