Class DesignedExperimentSimulation

java.lang.Object
edu.cmu.tetrad.algcomparison.simulation.DesignedExperimentSimulation
All Implemented Interfaces:
Simulation, HasParameters, ProvidesKnowledge, TetradSerializable, Serializable

public class DesignedExperimentSimulation extends Object implements Simulation, ProvidesKnowledge
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:
  1. 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.
  2. 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).
  3. 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, rows can be emitted sorted by configuration (deSortByConfiguration): grouped into configuration blocks, with the first factor swept through its full level grid in ascending order within each block and the remaining factors held constant per block, as in the Airfoil data file. The resulting file-order serial dependence is BLOCK structure (repeated measures), not time-series structure: block-constant factors read as near-1 lag-1 autocorrelation in file order, and the dependence collapses within groups. Block start rows are available from getConfigurationStarts(index), and deEmitConfigColumn appends a discrete CONFIG bookkeeping column naming each row's block (the analogue of TOWN in the corrected Boston Housing data; exclude it from search). Combined with selection, block lengths vary naturally.

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 Details

    • DesignedExperimentSimulation

      public DesignedExperimentSimulation(RandomGraph graph)
      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

      public void createData(Parameters parameters, boolean newModel)
      Creates simulated data and associated graphs based on the given parameters.
      Specified by:
      createData in interface Simulation
      Parameters:
      parameters - The parameters used to control the simulation process.
      newModel - A flag indicating whether a new model should be created.
    • getKnowledge

      public Knowledge 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). The random structure within a role - which factors couple, which feed which derived quantity - is NOT encoded.
      Specified by:
      getKnowledge in interface ProvidesKnowledge
      Parameters:
      index - the data model index.
      Returns:
      the knowledge.
    • getTrueGraph

      public Graph getTrueGraph(int index)
      Returns the true (pre-selection) graph at the specified index.
      Specified by:
      getTrueGraph in interface Simulation
      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:
      getNumDataModels in interface Simulation
      Returns:
      The number of data sets to simulate.
    • getDataModel

      public DataModel getDataModel(int index)
      Returns the data model at the specified index.
      Specified by:
      getDataModel in interface Simulation
      Parameters:
      index - The index of the desired simulated data set.
      Returns:
      The data model at the specified index.
    • getDataType

      public DataType getDataType()
      Returns the data type of the data set.
      Specified by:
      getDataType in interface Simulation
      Returns:
      The type of the data set.
    • getDescription

      public String getDescription()
      Returns the description of the simulation.
      Specified by:
      getDescription in interface Simulation
      Returns:
      a short, one-line description of the simulation.
    • getShortName

      public String getShortName()
      Returns the short name of the simulation.
      Specified by:
      getShortName in interface Simulation
      Returns:
      The short name of the simulation.
    • getParameters

      public List<String> getParameters()
      Retrieves the parameters required for the simulation. Graph parameters are omitted since the structure is generated internally.
      Specified by:
      getParameters in interface HasParameters
      Specified by:
      getParameters in interface Simulation
      Returns:
      A list of String names representing the parameters.
    • getRandomGraphClass

      public Class<? extends RandomGraph> getRandomGraphClass()
      Returns the random graph class used in the simulation (ignored for structure).
      Specified by:
      getRandomGraphClass in interface Simulation
      Returns:
      The class of the random graph.
    • getSimulationClass

      public Class<? extends Simulation> getSimulationClass()
      Returns the class of the current simulation.
      Specified by:
      getSimulationClass in interface Simulation
      Returns:
      The simulation class.