Class RandomMimic

java.lang.Object
edu.cmu.tetrad.graph.RandomMimic

public final class RandomMimic extends Object
Flexible MIMIC (Multiple Indicators Multiple Causes) graph generator.

Each group has a single latent factor (rank = 1), parentsPerGroup private measured cause nodes pointing into the latent, and childrenPerGroup measured indicator nodes pointed to by the latent. A random meta-DAG is built over the latents, optionally shared measured parents are added across pairs of latents, and impurities of three kinds can be introduced.

Impurities:

  • numLatentMeasuredImpureParents: extra latent -> measured cross-loadings
  • numMeasuredMeasuredImpureParents: measured -> measured directed edges
  • numMeasuredMeasuredImpureAssociations: measured <-> measured bidirected error correlations
  • Method Details

    • constructRandomMimic

      public static Graph constructRandomMimic(List<RandomMimic.MimicGroupSpec> specs, Integer metaEdgeCount, int numSharedParents, int numLatentMeasuredImpureParents, int numMeasuredMeasuredImpureParents, int numMeasuredMeasuredImpureAssociations)
      Constructs a random MIMIC graph with specified structural constraints. Each group has a single latent variable, private measured cause nodes (parents of the latent), and measured indicator nodes (children of the latent). A random meta-DAG is built over the latents, shared parents and impurities are added as specified.
      Parameters:
      specs - list of group specs (countGroups, childrenPerGroup, parentsPerGroup); must not be null or empty.
      metaEdgeCount - number of edges in the meta-DAG over latents; if null, ~20% of forward edges are chosen randomly.
      numSharedParents - number of new measured nodes each wired as a parent to a randomly chosen pair of latents.
      numLatentMeasuredImpureParents - extra latent->measured cross-loadings.
      numMeasuredMeasuredImpureParents - directed edges among measured nodes as impurities.
      numMeasuredMeasuredImpureAssociations - bidirected associations among measured nodes.
      Returns:
      the constructed MIMIC graph.
      Throws:
      IllegalArgumentException - if specs are null/empty, metaEdgeCount is out of range, or numSharedParents > 0 with fewer than 2 latents.
    • parseMimicGroupSpecs

      public static List<RandomMimic.MimicGroupSpec> parseMimicGroupSpecs(String value)
      Parses a specification string defining MIMIC group configurations into a list of MimicGroupSpec objects. Each configuration must follow the pattern: countGroups:childrenPerGroup:parentsPerGroup. Multiple configurations should be separated by commas (e.g., 5:6:3, 2:8:4).
      Parameters:
      value - the specification string; must not be null or empty.
      Returns:
      a list of parsed MimicGroupSpec objects.
      Throws:
      IllegalArgumentException - if the input is null, empty, or any token is malformed.