CAUSALDISCOVERY Procedure
Example 6.2 Learning a Large DAG by Using the MCV Algorithm
This example illustrates the accuracy and speed of the MCV algorithm, which is available in the CAUSALDISCOVERY procedure, by using a DAG that contains 1,000 variables and 6,000 edges.
In the following SAS code, the SIMULATE statement first simulates the DAG and then generates a 10,000-observation data set based on the simulated DAG. Then the LEARN statement estimates the DAG according to the simulated data set by using the MCV algorithm. Finally, the EVALUATE statement evaluates the accuracy of the estimated DAG.
proc causaldiscovery ;
var x1 - x1000;
simulate out=mylib.sdag outdata=mylib.outdata / nEdges=6000 nObs=10000
parm(dist=uniform(lb=-0.75 ub=0.75 excllb=-0.4 exclub=0.4)) seed=123
outparm = mylib.outparm outorder=mylib.outorder;
learn outdag=mylib.outdag /
algorithm=mcv initmethod=data
alpha=(0.1 0.01 0.0001 0.000001 0.00000001);
evaluate /out=mylib.oeval;
run;
The algorithm information is shown in Output 6.2.1.
Output 6.2.1: Algorithm Information
| Algorithm Information | |
|---|---|
| Algorithm | Minimizing Conditional Variance |
| Initialization Method | Data |
| Maximum Iterations | 200 |
| Parallel | Yes |
| Seed | 1 |
The following statements print the accuracy metrics, which are shown in Output 6.2.2:
proc print data=mylib.oeval noobs label;
format alpha f10.8;
format shd nme nee nre tpr f7.2;
label alpha='Significance Level'
shd='Structural Hamming Distance'
nme='N Missing Edges' nee='N Extra Edges'
nre='N Reverse Edges' tpr='True Positive Rate';
run;
Output 6.2.2: Accuracy of 1,000-Variable, 6,000-Edge DAG Structure Learning
| Significance Level | Structural Hamming Distance | N Missing Edges | N Extra Edges | N Reverse Edges | True Positive Rate |
|---|---|---|---|---|---|
| 0.00000001 | 0.00 | 0.00 | 0.00 | 0.00 | 1.00 |
| 0.00000100 | 1.00 | 0.00 | 1.00 | 0.00 | 1.00 |
| 0.00010000 | 43.00 | 0.00 | 43.00 | 0.00 | 1.00 |
| 0.01000000 | 5040.00 | 0.00 | 5040.00 | 0.00 | 1.00 |
| 0.10000000 | 49217.0 | 0.00 | 49217.0 | 0.00 | 1.00 |
| 1.00000000 | 493500 | 0.00 | 493500 | 0.00 | 1.00 |
The MCV algorithm has a 100% accuracy for a significance level of , and the true positive rate is 100%. The algorithm is very fast, taking only a few seconds when you run the code in this example on one CPU.