Skip to content

NeighborError: why nodes in the MAG can not have neighbors and meanwhile parents/spouse? #3

@lmz123321

Description

@lmz123321

I got the following error when trying to create an AncestralGraph object:

NeighborError: The node X7 has parents X8. Nodes cannot have neighbors and parents/spouses.

Checking the source code in graphical_models.classes.mags.ancestral_graph, it seems that the neighbors of a node $X$ contains any node $Y$ such that $X-Y$ in the MAG, the spouses contains any node $Y$ such that $X\leftrightarrow Y$ in the MAG.

So, my question is:

Why a node can not have a neighbor and a parent/spouse at the same time?

This scenarios seems reasonable, for example:

The underlying DAG is $X\to S \leftarrow Y \leftarrow A$, where $S$ is a selection variable, then the corresponding MAG is $X - Y \leftarrow A$, right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions