You could use Omega to generate the toy model instead of
N = 1000 # number of data points
define simple linear model with added noise
x = randn(N)
v = x + randn(N)0.25
w = x + randn(N)0.25
z = v + w + randn(N)0.25
s = z + randn(N)0.25
df = (x=x, v=v, w=w, z=z, s=s)
* It would be useful to review the conditional independence tests: https://en.wikipedia.org/wiki/Partial_correlation#As_conditional_independence_test We have that in https://juliastats.org/HypothesisTests.jl/latest/multivariate/#Partial-correlation-test-1
* The PC algorithm starts pessimistic with a full graph assuming everything depends on everything and removes edges according to conditional independence test to find the Markov blanket (an undirected dependence graph). In a later step the edges in the graph are oriented according to a number of rules. The output is a partially directed acyclic graph (CPDAG).
* The PC algorithm just starts like this: In the first round `l=0` all edges between independent variables are removed. In the second round `l = 1`....
<img width="1154" alt="Screen Shot 2021-06-17 at 10 07 48" src="https://user-images.githubusercontent.com/1923437/122357709-419ddf80-cf54-11eb-98ad-742e16ea9908.png">
(this is from https://jmlr.org/papers/volume15/colombo14a/colombo14a.pdf which the implementation in CausalInference follows.)
* You can check for independence (l = 0) and conditional independence (l = 1) on the toy data yourself using https://juliastats.org/HypothesisTests.jl/latest/multivariate/#Partial-correlation-test-1 and remove those edges from a full graph.
I'd suggest do go through the tutorial on the PC algorithm https://mschauer.github.io/CausalInference.jl/latest/examples/pc_basic_examples/ perhaps with background info:
define simple linear model with added noise
x = randn(N) v = x + randn(N)0.25 w = x + randn(N)0.25 z = v + w + randn(N)0.25 s = z + randn(N)0.25
df = (x=x, v=v, w=w, z=z, s=s)