MAG.to.DAG | R Documentation |
This function converts a Mixed Acyclic Graph (MAG) into a Directed Acyclic Graph (MAG), by adding a latent for each pair of dependent errors in the MAG. More details can be found in Shipley, B. & Douma, J. Testing piecewise structural equations models in the presence of latent variables, including correlated errors. It is typically used to obtain a DAG from which the d-sep equivalent MAG can be derived and its basis-set.
MAG.to.DAG(full.MAG)
full.DAG |
a named binary matrix encoding the MAG. This is typically obtained via the DAG function of the ggm library. |
This function inputs a Mixed Acyclic Graph (MAG) and outputs the Directed Acyclic Graph (MAG).
The resulting MAG is output from this function as a matrix.
Bob Douma
Shipley, B. & Douma, J. Testing piecewise structural equations models in the presence of latent variables, including correlated errors.
dsep.test
, basiSet.mag
, DAG,
DAG.to.MAG
library(ggm) initial.mag <- makeMG(dg=DAG(X3~X1+X2,X4~X3,X5~X4),bg=UG(~X1*X2+~X3*X5)) plotGraph(initial.mag) # plotgraph my.DAG <- MAG.to.DAG(initial.mag) # resulting DAG my.mag <- DAG.to.MAG(my.dag,latents=c("L1","L2")) plotGraph(my.mag) basiSet.mag(my.mag)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.