Class DaoSimulation
- All Implemented Interfaces:
Simulation, HasParameters, TetradSerializable, Serializable
daoErrorDistribution), as described in:
Andrews, B. & Kummerfeld, E. (2024). "Better Simulations for Validating Causal Discovery with the DAG-Adaptation of the Onion Method." arXiv:2405.13100.
Reference Python implementation: ...
The key idea is to sample the correlation matrix R uniformly over the space of all correlation matrices satisfying the Markov property for the given DAG, rather than sampling edge weights directly (as most other simulations do). This avoids simulation artifacts such as varsortability and R²-sortability.
The algorithm proceeds in topological order over the DAG. For each non-source variable i with parents pa(i), it:
- Builds a permutation matrix P that puts parents first among predecessors.
- Computes the Cholesky factor L of the permuted sub-correlation matrix.
- Samples w from the multivariate Pearson Type II distribution mPII_k(gamma), with nonzero entries only in the first k (parent) slots.
- Recovers marginal correlations r = P L w, structural coefficients b = P L^{-T} w, and error variance o = 1 - w^T w.
Optional graph-rewiring steps:
daoSfOut— rewires to produce a scale-free out-degree distributiondaoSfIn— rewires to produce a scale-free in-degree distributiondaoRandomizeOrder— randomly permutes variable order after rewiring
- Author:
- Bryan Andrews (algorithm); Java translation for Tetrad
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDaoSimulation(RandomGraph randomGraph) Constructs a DaoSimulation using the suppliedRandomGraphto produce the true DAG on each run.DaoSimulation(Graph trueGraph) Convenience constructor that fixes a single, predetermined true DAG. -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateData(Parameters parameters, boolean newModel) Creates a data set and simulates data.getDataModel(int index) Returns the number of data sets to simulate.Returns the data type of the data.Returns the description of the simulation.intReturns the number of data models.Returns the list of parameters used in the simulation.Class<? extends RandomGraph> Retrieves the class of a random graph for the simulation.Returns the short name of the simulation.Class<? extends Simulation> Returns the class of the simulation.getTrueGraph(int index) Returns the true graph at the given index.soficOrder(Graph dag) Returns a source-first consistent topological ordering of the DAG nodes.
-
Constructor Details
-
DaoSimulation
Constructs a DaoSimulation using the suppliedRandomGraphto produce the true DAG on each run.- Parameters:
randomGraph- source of true DAGs; must not be null.
-
DaoSimulation
Convenience constructor that fixes a single, predetermined true DAG.- Parameters:
trueGraph- the DAG to use for every run; must not be null.
-
-
Method Details
-
createData
Creates a data set and simulates data.Creates
NUM_RUNSdata sets, each drawn from the DaO method applied to the true DAG. IfDIFFERENT_GRAPHSis true, a fresh DAG is generated for each run.- Specified by:
createDatain interfaceSimulation- Parameters:
parameters- The parameters to use in the simulation.newModel- If true, a new model is created. If false, the model is reused.
-
getTrueGraph
Description copied from interface:SimulationReturns the true graph at the given index.- Specified by:
getTrueGraphin interfaceSimulation- Parameters:
index- The index of the desired true graph.- Returns:
- That graph.
-
getNumDataModels
public int getNumDataModels()Description copied from interface:SimulationReturns the number of data models.- Specified by:
getNumDataModelsin interfaceSimulation- Returns:
- The number of data sets to simulate.
-
getDataModel
Description copied from interface:SimulationReturns the number of data sets to simulate.- Specified by:
getDataModelin interfaceSimulation- Parameters:
index- The index of the desired simulated data set.- Returns:
- That data set.
-
getDataType
Description copied from interface:SimulationReturns the data type of the data.- Specified by:
getDataTypein interfaceSimulation- Returns:
- Returns the type of the data, continuous, discrete or mixed.
-
getDescription
Description copied from interface:SimulationReturns the description of the simulation.- Specified by:
getDescriptionin interfaceSimulation- Returns:
- Returns a one-line description of the simulation, to be printed at the beginning of the report.
-
getShortName
Description copied from interface:SimulationReturns the short name of the simulation.- Specified by:
getShortNamein interfaceSimulation- Returns:
- The short name of the simulation.
-
getParameters
Description copied from interface:SimulationReturns the list of parameters used in the simulation.- Specified by:
getParametersin interfaceHasParameters- Specified by:
getParametersin interfaceSimulation- Returns:
- Returns the parameters used in the simulation. These are the parameters whose values can be varied.
-
getRandomGraphClass
Description copied from interface:SimulationRetrieves the class of a random graph for the simulation.- Specified by:
getRandomGraphClassin interfaceSimulation- Returns:
- The class of a random graph for the simulation.
-
getSimulationClass
Description copied from interface:SimulationReturns the class of the simulation. This method is used to retrieve the class of a simulation based on the selected simulations in the model.- Specified by:
getSimulationClassin interfaceSimulation- Returns:
- The class of the simulation.
-
soficOrder
Returns a source-first consistent topological ordering of the DAG nodes. Translation of Pythonsofic_order(g): sources are placed first, then each node is appended once all its parents have been placed.- Parameters:
dag- the DAG- Returns:
- nodes in source-first topological order
-