The following binders provide examples for using the cegpy package. API documentation can be found at cegpy.readthedocs.org.
This first example builds a Chain Event Graph (CEG) from a discrete dataset showing results from a medical experiment. The dataset used is symetrical, built from a rectangular dataset. These CEGs are known as stratified in the literature.
This example builds a Chain Event Graph (CEG) from a asymmetric dataset. In simple words, a dataset is asymmetric when the event tree describing the dataset is not symmetric around its root. The class of CEGs built from asymmetric event trees is said to be non-stratified.
A complete CEG shows all possible trajectories that an individual undergoing the process might experience. However, on observing any evidence, certain or uncertain, some edges and nodes become unvisited with probability 1. The CEG model can be reduced such that these edges and nodes are excluded, without any loss of information. Once reduced, the probabilities displayed can be also be revised.
The package, by default, treats all blank and NaN
cells as structural missing values. However, sometimes these might occur due to sampling limitations. On the other hand, we might not observe a certain value for a variable (given its ancestral variables) not because that value is a structural zero but because of sampling limitations.
In this example we cover two things,
- How to define arguments to allow the package to distinguish between structual and sampling missing values?
- How to add a value which has not been observed in the dataset due to sampling limitations (i.e. its frequency is a sampling zero)?
The AHC is typically loaded with certain default parameters. If these are not suitable for your application, these can be modified.