Learn R Programming

caugi (version 1.0.0)

condition_marginalize: Marginalize and/or condition on variables in an ancestral graph (AG)

Description

Marginalize 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.

Usage

condition_marginalize(cg, cond_vars = NULL, marg_vars = NULL)

Value

A caugi object of class "AG".

Arguments

cg

A caugi ancestral graph of class "AG".

cond_vars

Character vector of nodes to condition on.

marg_vars

Character vector of nodes to marginalize over.

References

Definition 4.2.1 in Thomas Richardson. Peter Spirtes. "Ancestral graph Markov models." Ann. Statist. 30 (4) 962 - 1030, August 2002. tools:::Rd_expr_doi("10.1214/aos/1031689015")

See Also

Other operations: exogenize(), latent_project(), moralize(), mutate_caugi(), skeleton()

Examples

Run this code
mg <- caugi(
  U %-->% X + Y,
  A %-->% X,
  B %-->% Y,
  class = "DAG"
)

condition_marginalize(mg, marg_vars = "U") # ADMG
condition_marginalize(mg, cond_vars = "U") # DAG

Run the code above in your browser using DataLab