Projects out latent (unobserved) variables from a DAG to produce an Acyclic Directed Mixed Graph (ADMG) over the observed variables.
See also
Other operations:
condition_marginalize(),
exogenize(),
moralize(),
mutate_caugi(),
skeleton()
Examples
# DAG with latent confounder U
dag <- caugi(
U %-->% X,
U %-->% Y,
X %-->% Y,
class = "DAG"
)
# Project out the latent variable
admg <- latent_project(dag, latents = "U")
# Result: X -> Y, X <-> Y (children of U become bidirected-connected)
edges(admg)
#> from edge to
#> <char> <char> <char>
#> 1: X --> Y
#> 2: X <-> Y
# DAG with directed path through latent
dag2 <- caugi(
X %-->% L,
L %-->% Y,
class = "DAG"
)
# Project out the latent variable
admg2 <- latent_project(dag2, latents = "L")
# Result: X -> Y (directed path X -> L -> Y becomes X -> Y)
edges(admg2)
#> from edge to
#> <char> <char> <char>
#> 1: X --> Y