Learn R Programming

caugi (version 1.1.0)

posteriors: Get posteriors of nodes in a caugi

Description

Get the posterior set of nodes in a graph. The posterior set (dual of the anterior set from Richardson and Spirtes, 2002) includes all nodes reachable by following paths where every edge is either undirected or directed away from the source node.

For DAGs, the posterior set equals the descendant set (since there are no undirected edges). For PDAGs, it includes both descendants and nodes reachable via undirected edges.

Usage

posteriors(
  cg,
  nodes = NULL,
  index = NULL,
  open = caugi_options("use_open_graph_definition")
)

Value

Either a character vector of node names (if a single node is requested) or a list of character vectors (if multiple nodes are requested).

Arguments

cg

A caugi object of class DAG, PDAG, or AG.

nodes

A character vector of node names.

index

A vector of node indexes.

open

Boolean. Determines how the graph is interpreted when retrieving posteriors. Default is taken from caugi_options("use_open_graph_definition"), which by default is TRUE.

See Also

Other queries: ancestors(), anteriors(), children(), descendants(), districts(), edge_types(), edges(), exogenous(), is_acyclic(), is_admg(), is_ag(), is_caugi(), is_cpdag(), is_dag(), is_empty_caugi(), is_mag(), is_mpdag(), is_pdag(), is_simple(), is_ug(), m_separated(), markov_blanket(), neighbors(), nodes(), parents(), same_nodes(), spouses(), subgraph(), topological_sort()

Examples

Run this code
# PDAG example with directed and undirected edges
cg <- caugi(
  A %-->% B %---% C,
  B %-->% D,
  class = "PDAG"
)

posteriors(cg, "A") # B, C, D
posteriors(cg, "A", open = FALSE) # A, B, C, D
posteriors(cg, "B") # C, D
posteriors(cg, "D") # NULL (no posteriors)

# For DAGs, posteriors equals descendants
cg_dag <- caugi(
  A %-->% B %-->% C,
  class = "DAG"
)
posteriors(cg_dag, "A") # B, C

Run the code above in your browser using DataLab