Class LeeHastieSimulation

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

public class LeeHastieSimulation extends Object implements Simulation
A version of the Lee and Hastic simulation.
Version:
$Id: $Id
Author:
josephramsey
See Also:
  • Constructor Details

    • LeeHastieSimulation

      public LeeHastieSimulation(RandomGraph graph)

      Constructor for LeeHastieSimulation.

      Parameters:
      graph - a RandomGraph object
  • Method Details

    • makeMixedGraph

      public static Graph makeMixedGraph(Graph g, Map<String,Integer> m)

      makeMixedGraph.

      Parameters:
      g - a Graph object
      m - a Map object
      Returns:
      a Graph object
    • GaussianCategoricalPm

      public static GeneralizedSemPm GaussianCategoricalPm(Graph trueGraph, String paramTemplate) throws IllegalStateException

      GaussianCategoricalPm.

      Parameters:
      trueGraph - a Graph object
      paramTemplate - a String object
      Returns:
      a GeneralizedSemPm object
      Throws:
      IllegalStateException - if any.
    • GaussianCategoricalIm

      public static GeneralizedSemIm GaussianCategoricalIm(GeneralizedSemPm pm)

      GaussianCategoricalIm.

      Parameters:
      pm - a GeneralizedSemPm object
      Returns:
      a GeneralizedSemIm object
    • GaussianCategoricalIm

      public static GeneralizedSemIm GaussianCategoricalIm(GeneralizedSemPm pm, boolean discParamRand)
      This method is needed to normalize edge parameters for an Instantiated Mixed Model Generates edge parameters for c-d and d-d edges from a single weight, abs(w), drawn by the normal IM constructor. Abs(w) is used for d-d edges.

      For deterministic, c-d are evenly spaced between -w and w, and d-d are a matrix with w on the diagonal and -w/(categories-1) in the rest. For random, c-d params are uniformly drawn from 0 to 1 then transformed to have w as max value and sum to 0.

      Parameters:
      pm - a GeneralizedSemPm object
      discParamRand - true for random edge generation behavior, false for deterministic
      Returns:
      a GeneralizedSemIm object
    • makeMixedData

      public static DataSet makeMixedData(DataSet dsCont, Map<String,Integer> nodeDists)

      makeMixedData.

      Parameters:
      dsCont - a DataSet object
      nodeDists - a Map object
      Returns:
      a DataSet object
    • makeMixedData

      public static DataSet makeMixedData(DataSet dsCont, Map<String,String> nodeDists, int numCategories)

      makeMixedData.

      Parameters:
      dsCont - a DataSet object
      nodeDists - a Map object
      numCategories - a int
      Returns:
      a DataSet object
    • getNodeDists

      public static Map<String,Integer> getNodeDists(Graph g)

      getNodeDists.

      Parameters:
      g - a Graph object
      Returns:
      a Map object
    • getEdgeParams

      public static List<String> getEdgeParams(Node n1, Node n2, GeneralizedSemPm pm)

      getEdgeParams.

      Parameters:
      n1 - a Node object
      n2 - a Node object
      pm - a GeneralizedSemPm object
      Returns:
      a List object
    • arrayPermute

      public static int[] arrayPermute(int[] a)

      arrayPermute.

      Parameters:
      a - an array of objects
      Returns:
      an array of objects
    • generateMixedEdgeParams

      public static double[] generateMixedEdgeParams(double w, int L)

      generateMixedEdgeParams.

      Parameters:
      w - a double
      L - a int
      Returns:
      an array of objects
    • evenSplitVector

      public static double[] evenSplitVector(double w, int L)

      evenSplitVector.

      Parameters:
      w - a double
      L - a int
      Returns:
      an array of objects
    • createData

      public void createData(Parameters parameters, boolean newModel)
      Creates a data set and simulates data.
      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.
    • getTrueGraph

      public Graph getTrueGraph(int index)
      Returns the true graph at the given index.
      Specified by:
      getTrueGraph in interface Simulation
      Parameters:
      index - The index of the desired true graph.
      Returns:
      That graph.
    • getDataModel

      public DataModel getDataModel(int index)
      Returns the number of data sets to simulate.
      Specified by:
      getDataModel in interface Simulation
      Parameters:
      index - The index of the desired simulated data set.
      Returns:
      That data set.
    • getDescription

      public String getDescription()
      Returns the description of the simulation.
      Specified by:
      getDescription in interface Simulation
      Returns:
      Returns a one-line description of the simulation, to be printed at the beginning of the report.
    • 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()
      Returns the list of parameters used in the simulation.
      Specified by:
      getParameters in interface HasParameters
      Specified by:
      getParameters in interface Simulation
      Returns:
      Returns the parameters used in the simulation. These are the parameters whose values can be varied.
    • 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.
    • getNumDataModels

      public int getNumDataModels()
      Returns the number of data models.
      Specified by:
      getNumDataModels in interface Simulation
      Returns:
      The number of data sets to simulate.
    • getDataType

      public DataType getDataType()
      Returns the data type of the data.
      Specified by:
      getDataType in interface Simulation
      Returns:
      Returns the type of the data, continuous, discrete or mixed.