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

The CAUSALDISCOVERY Procedure

Algorithm Information
AlgorithmMinimizing Conditional Variance
Initialization MethodData
Maximum Iterations200
ParallelYes
Seed1


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 LevelStructural Hamming
Distance
N Missing EdgesN Extra EdgesN Reverse EdgesTrue Positive
Rate
0.000000010.000.000.000.001.00
0.000001001.000.001.000.001.00
0.0001000043.000.0043.000.001.00
0.010000005040.000.005040.000.001.00
0.1000000049217.00.0049217.00.001.00
1.000000004935000.004935000.001.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.

Last updated: July 09, 2026