Class RandomMim
java.lang.Object
edu.cmu.tetrad.graph.RandomMim
Flexible MIM (Multiple Indicator Model) generator.
A "group" is a structural node in the meta-DAG. Each group has rank many latent factors,
and childrenPerGroup many measured indicators. For a meta-edge G_i -> G_j, directed edges
are added from each latent in G_i to each latent in G_j according to the chosen
RandomMim.LatentLinkMode.
Impurities:
- numLatentMeasuredImpureParents: extra latent -> measured cross-loadings
- numMeasuredMeasuredImpureParents: measured -> measured directed edges
- numMeasuredMeasuredImpureAssociations: measured <-> measured bidirected error correlations
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordSpecification for a block of groups sharing the same rank and number of children per latent.static enumEnum representing the mode of linking between latent nodes across groups in the meta-DAG. -
Method Summary
Modifier and TypeMethodDescriptionstatic GraphconstructRandomMim(List<RandomMim.LatentGroupSpec> specs, Integer metaEdgeCount, int numLatentMeasuredImpureParents, int numMeasuredMeasuredImpureParents, int numMeasuredMeasuredImpureAssociations, RandomMim.LatentLinkMode latentLinkMode) Constructs a random meta-graph as a Multiple Indicator Model (MIM) with specified structural constraints.static List<RandomMim.LatentGroupSpec> parseLatentGroupSpecs(String value) Parses a specification string defining latent group configurations into a list ofLatentGroupSpecobjects.
-
Method Details
-
constructRandomMim
public static Graph constructRandomMim(List<RandomMim.LatentGroupSpec> specs, Integer metaEdgeCount, int numLatentMeasuredImpureParents, int numMeasuredMeasuredImpureParents, int numMeasuredMeasuredImpureAssociations, RandomMim.LatentLinkMode latentLinkMode) Constructs a random meta-graph as a Multiple Indicator Model (MIM) with specified structural constraints. This method generates latent groups based on the provided specifications, builds a meta-DAG among the groups, and materializes the graph with impurities such as cross-loadings, directed impurities, and bidirectional associations over measured nodes.- Parameters:
specs- the list of specifications describing latent groups, including group ranks and children per group; must not be null or empty.metaEdgeCount- the number of edges in the meta-DAG over latent groups; if null, a random proportion (~20%) of possible forward edges is chosen instead.numLatentMeasuredImpureParents- the number of additional latent-to-measured cross-loadings to introduce.numMeasuredMeasuredImpureParents- the number of directed edges to introduce among measured nodes as impurities.numMeasuredMeasuredImpureAssociations- the number of bidirectional associations to introduce among measured nodes.latentLinkMode- the mode of linking latents between groups in the meta-DAG.- Returns:
- the constructed graph representing the random MIM with all specified constraints and impurities.
- Throws:
IllegalArgumentException- if the specifications are null, empty, or malformed, if the number of meta-edges is out of valid range, or if the latentLinkMode is unrecognized.
-
parseLatentGroupSpecs
Parses a specification string defining latent group configurations into a list ofLatentGroupSpecobjects. Each configuration must follow the pattern:countGroups:childrenPerGroup(rank). Multiple configurations should be separated by commas (e.g.,5:3(2), 4:6(1)).- Parameters:
value- the specification string; must not be null or empty.- Returns:
- a list of parsed
LatentGroupSpecobjects. - Throws:
IllegalArgumentException- if the input is null, empty, or any token is malformed.
-