MAG.mSeparation
- MAG.mSeparation(*args)
Test the m-separation (the separation of the MAG: the d-separation of the DAGs it represents).
- Parameters:
X (
intorset[int]) – a node or a set of nodesY (
intorset[int]) – a node or a set of nodesZ (
intorset[int], optional) – the conditioning nodes (none by default)
- Returns:
True if X and Y are m-separated by Z
- Return type:
bool- Raises:
pyagrum.InvalidArgument – if X and Y are not disjoint
pyagrum.InvalidNode – if a node of X, Y or Z is not a node of the MAG
See also
pyagrum.graph.separationthe separation criterion of each kind of graph
Example
import pyagrum as gum
dag = gum.fastDAG("A->X;Y<-B;X<-T->Y")
mag = gum.MAG.fromDAG(dag, {4}) # T latent: A->X<->Y<-B
mag.mSeparation(0, 3)
# True
mag.mSeparation(0, 3, {1, 2}) # X and Y are colliders
# False
Class