Skip to main content

Normalize latent structure

Source: R/transform.R

Description

Simplifies the latent nodes of cg while preserving the induced marginal model over the observed variables (Lemmas 1-3 of the reference below). It exogenizes each latent node, then drops latent nodes with at most one active child or whose child set is a strict subset of another latent node’s child set.

Usage

Arguments

cg A DAG created with cgraph().
latents Character vector of latent (unobserved) node names.

Value

A cgraph of class DAG.

References

Evans RJ (2016). “Graphs for margins of Bayesian networks.” Scandinavian Journal of Statistics, 43(3), 625–648.

Examples

dag <- cgraph(U %-->% A, U %-->% B, A %-->% B)
normalize_latent_structure(dag, "U")
#> DAG with 3 nodes and 3 edges:
#>   nodes: A, B, U
#>   edges:
#>     A --> B, U --> A, U --> B