MAG.mSeparation

MAG.mSeparation(*args)

Test the m-separation (the separation of the MAG: the d-separation of the DAGs it represents).

Parameters:
  • X (int or set[int]) – a node or a set of nodes

  • Y (int or set[int]) – a node or a set of nodes

  • Z (int or set[int], optional) – the conditioning nodes (none by default)

Returns:

True if X and Y are m-separated by Z

Return type:

bool

Raises:

See also

pyagrum.graph.separation

the 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

MAG