Class DesignedExperimentSimulation
java.lang.Object
edu.cmu.tetrad.algcomparison.simulation.DesignedExperimentSimulation
- All Implemented Interfaces:
Simulation, HasParameters, ProvidesKnowledge, TetradSerializable, Serializable
Simulates data with the anatomy of a designed physical experiment (the archetype is the NASA
Airfoil Self-Noise dataset), in contrast to an observational sample. The variables come in
three tiers:
- Design factors (F1, F2, ...): grid-valued exogenous inputs, each taking a small number of evenly spaced levels sampled uniformly. These are SET by the experimenter, not sampled from a noise distribution. Optionally, a factor's level values are coupled to an earlier factor (a non-factorial design, as when larger chord lengths are tested only at smaller attack angles): with probability deCoupling, a factor's value range is scaled by a random earlier uncoupled factor, producing strong protocol-induced dependence among the inputs. Coupling appears as a directed edge in the true graph, since that is the true data-generating dependence.
- Derived intermediates (D1, ...): near-deterministic smooth functions of a subset of the factors and of EARLIER derived variables (chains, like ISI/BUI feeding FWI), with noise standard deviation deDerivedNoise (default 0.05, i.e., R-squared near 1 given parents).
- Responses (R1, ...): the genuinely measured outputs. Each response is a function of all factors and derived variables, mixing an additive part with a pairwise-interaction part by weight deInteraction (interaction-heavy physics like Strouhal scaling), plus heterogeneous non-Gaussian noise with standard deviation deResponseNoise.
Optionally, selection on measurability is applied (deSelection): the lowest deSelection fraction of rows by (first response + noise) is dropped, as when rows exist only where the response was above a noise floor. This induces additional dependence among the inputs in the observed sample that is NOT in the true graph; the stored true graph is the pre-selection DAG, so searches on selected data are expected to show extra input-input edges. That phenomenon is part of what this simulation is for.
NOTE: the random graph passed to the constructor is IGNORED; the tiered structure is generated internally from the deNumFactors / deNumDerived / deNumResponses parameters.
- Author:
- josephramsey
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a DesignedExperimentSimulation. -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateData(Parameters parameters, boolean newModel) Creates simulated data and associated graphs based on the given parameters.int[]getConfigurationStarts(int index) Returns the starting row of each configuration block in the emitted data for the given simulation index: ascending, beginning with 0; a single block covering all rows when deSortByConfiguration is off.getDataModel(int index) Returns the data model at the specified index.Returns the data type of the data set.Returns the description of the simulation.getKnowledge(int index) Returns the design-implied knowledge for the given data model: tiers by role, factors (F) before derived quantities (D) before responses (R), with the CONFIG bookkeeping column, when emitted, in a tier of its own before all of these (its fixed-effects reading).intReturns the number of data models.Retrieves the parameters required for the simulation.Class<? extends RandomGraph> Returns the random graph class used in the simulation (ignored for structure).Returns the short name of the simulation.Class<? extends Simulation> Returns the class of the current simulation.getTrueGraph(int index) Returns the true (pre-selection) graph at the specified index.
-
Constructor Details
-
DesignedExperimentSimulation
Constructs a DesignedExperimentSimulation. The given random graph is ignored; the tiered design structure is generated internally from parameters.- Parameters:
graph- the RandomGraph object (ignored).
-
-
Method Details
-
createData
Creates simulated data and associated graphs based on the given parameters.- Specified by:
createDatain interfaceSimulation- Parameters:
parameters- The parameters used to control the simulation process.newModel- A flag indicating whether a new model should be created.
-
getKnowledge
Returns the design-implied knowledge for the given data model: tiers by role, factors (F) before derived quantities (D) before responses (R), with the CONFIG bookkeeping column, when emitted, in a tier of its own before all of these (its fixed-effects reading). The random structure within a role - which factors couple, which feed which derived quantity - is NOT encoded.- Specified by:
getKnowledgein interfaceProvidesKnowledge- Parameters:
index- the data model index.- Returns:
- the knowledge.
-
getTrueGraph
Returns the true (pre-selection) graph at the specified index.- Specified by:
getTrueGraphin interfaceSimulation- Parameters:
index- The index of the desired true graph.- Returns:
- The true graph at the specified index.
-
getConfigurationStarts
public int[] getConfigurationStarts(int index) Returns the starting row of each configuration block in the emitted data for the given simulation index: ascending, beginning with 0; a single block covering all rows when deSortByConfiguration is off. Useful for grouped analyses and blocks-by-configuration resampling.- Parameters:
index- the simulation index.- Returns:
- the block start rows.
-
getNumDataModels
public int getNumDataModels()Returns the number of data models.- Specified by:
getNumDataModelsin interfaceSimulation- Returns:
- The number of data sets to simulate.
-
getDataModel
Returns the data model at the specified index.- Specified by:
getDataModelin interfaceSimulation- Parameters:
index- The index of the desired simulated data set.- Returns:
- The data model at the specified index.
-
getDataType
Returns the data type of the data set.- Specified by:
getDataTypein interfaceSimulation- Returns:
- The type of the data set.
-
getDescription
Returns the description of the simulation.- Specified by:
getDescriptionin interfaceSimulation- Returns:
- a short, one-line description of the simulation.
-
getShortName
Returns the short name of the simulation.- Specified by:
getShortNamein interfaceSimulation- Returns:
- The short name of the simulation.
-
getParameters
Retrieves the parameters required for the simulation. Graph parameters are omitted since the structure is generated internally.- Specified by:
getParametersin interfaceHasParameters- Specified by:
getParametersin interfaceSimulation- Returns:
- A list of String names representing the parameters.
-
getRandomGraphClass
Returns the random graph class used in the simulation (ignored for structure).- Specified by:
getRandomGraphClassin interfaceSimulation- Returns:
- The class of the random graph.
-
getSimulationClass
Returns the class of the current simulation.- Specified by:
getSimulationClassin interfaceSimulation- Returns:
- The simulation class.
-