Class GeneralSemSimulation

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

public class GeneralSemSimulation extends Object implements Simulation
The GeneralSemSimulation class represents a simulation using a generalized structural equation model (SEM). It allows for simulation of data sets based on different parameter settings and graph structures.
See Also:
  • Constructor Details

    • GeneralSemSimulation

      public GeneralSemSimulation(RandomGraph graph)
      Constructs a GeneralSemSimulation object with the given RandomGraph object.
      Parameters:
      graph - the RandomGraph object used for simulation.
      Throws:
      NullPointerException - if graph is null.
    • GeneralSemSimulation

      public GeneralSemSimulation(GeneralizedSemPm pm)
      Initializes a GeneralSemSimulation with the given GeneralizedSemPm object.
      Parameters:
      pm - the GeneralizedSemPm object used for simulation.
      Throws:
      NullPointerException - if pm is null.
    • GeneralSemSimulation

      public GeneralSemSimulation(GeneralizedSemIm im)
      Constructs a GeneralSemSimulation object with the given GeneralizedSemIm object.
      Parameters:
      im - the GeneralizedSemIm object used for simulation
  • Method Details

    • createData

      public void createData(Parameters parameters, boolean newModel)
      Creates data sets for simulation based on the given parameters and model reuse preference.
      Specified by:
      createData in interface Simulation
      Parameters:
      parameters - The parameters to use in the simulation.
      newModel - If true, a new model is created. If false, the model is reused.
    • getIms

      public List<GeneralizedSemIm> getIms()
      Retrieves the list of GeneralizedSemIm objects used for simulation.
      Returns:
      The list of GeneralizedSemIm objects.
    • getTrueGraph

      public Graph getTrueGraph(int index)
      Returns the true 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.
    • 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--continuous if all continuous variables, discrete if all discrete variables; otherwise, mixed.
    • 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.
      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()
      Description copied from interface: Simulation
      Retrieves the class of a random graph for the simulation.
      Specified by:
      getRandomGraphClass in interface Simulation
      Returns:
      The class of a random graph for the simulation.
    • getSimulationClass

      public Class<? extends Simulation> getSimulationClass()
      Description copied from interface: Simulation
      Returns 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:
      getSimulationClass in interface Simulation
      Returns:
      The class of the simulation.