Package edu.cmu.tetrad.sem
Class GeneralizedSemIm
java.lang.Object
edu.cmu.tetrad.sem.GeneralizedSemIm
- All Implemented Interfaces:
- Simulator,- IM,- TetradSerializable,- Serializable
Represents a generalized SEM instantiated model. The parameteric form of this
 model allows arbitrary equations for variables. This instantiated model
 gives values for all of the parameters of the parameterized model.
- Author:
- Joseph Ramsey
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs a new GeneralizedSemIm from the given GeneralizedSemPm by picking values for each of the freeParameters from their initial distributions.GeneralizedSemIm(GeneralizedSemPm pm, SemIm semIm) 
- 
Method SummaryModifier and TypeMethodDescriptiongetNodeSubstitutedString(Node node) getNodeSubstitutedString(Node node, Map<String, Double> substitutedValues) doublegetParameterValue(String parameter) getSemPm()static GeneralizedSemImGenerates a simple exemplar of this class to test serialization.voidsetGuaranteeIid(boolean guaranteeIid) voidsetParameterValue(String parameter, double value) voidsetSubstitutions(Map<String, Double> parameterValues) simulateData(int sampleSize, boolean latentDataSaved) simulateDataAvoidInfinity(int sampleSize, boolean latentDataSaved) simulateDataFisher(int sampleSize) Simulates data using the model of R.simulateDataFisher(int sampleSize, int intervalBetweenShocks, double epsilon) Simulates data using the model of R.simulateDataMinimizeSurface(int sampleSize, boolean latentDataSaved) simulateDataNSteps(int sampleSize, boolean latentDataSaved) simulateDataRecursive(int sampleSize, boolean latentDataSaved) This simulates data by picking random values for the exogenous terms and percolating this information down through the SEM, assuming it is acyclic.toString()
- 
Constructor Details- 
GeneralizedSemImConstructs a new GeneralizedSemIm from the given GeneralizedSemPm by picking values for each of the freeParameters from their initial distributions.- Parameters:
- pm- the GeneralizedSemPm. Includes all of the equations and distributions of the model.
 
- 
GeneralizedSemIm
 
- 
- 
Method Details- 
serializableInstanceGenerates a simple exemplar of this class to test serialization.
- 
getGeneralizedSemPm- Returns:
- a copy of the stored GeneralizedSemPm.
 
- 
setParameterValue- Parameters:
- parameter- The parameter whose values is to be set.
- value- The double value that- paramis to be set to.
 
- 
getParameterValue- Parameters:
- parameter- The parameter whose value is to be retrieved.
- Returns:
- The retrieved value.
 
- 
getNodeSubstitutedString- Returns:
- the user's String formula with numbers substituted for freeParameters, where substitutions exist.
 
- 
getNodeSubstitutedString- Parameters:
- node- The node whose expression is being evaluated.
- substitutedValues- A mapping from Strings parameter names to Double values; these values will be substituted for the stored values where applicable.
- Returns:
- the expression string with values substituted for freeParameters.
 
- 
toString
- 
simulateData- Specified by:
- simulateDatain interface- Simulator
 
- 
simulateDataRecursiveThis simulates data by picking random values for the exogenous terms and percolating this information down through the SEM, assuming it is acyclic. Fast for large simulations but hangs for cyclic models.- Parameters:
- sampleSize- > 0.
- Returns:
- the simulated data set.
 
- 
simulateDataMinimizeSurface
- 
simulateDataAvoidInfinity
- 
simulateDataFisherSimulates data using the model of R. A. Fisher, for a linear model. Shocks are applied every so many steps. A data point is recorded before each shock is administered. If convergence happens before that number of steps has been reached, a data point is recorded and a new shock immediately applied. The model may be cyclic. If cyclic, all eigenvalues for the coefficient matrix must be less than 1, though this is not checked. Uses an interval between shocks of 50 and a convergence threshold of 1e-5. Uncorrelated Gaussian shocks are used.- Parameters:
- sampleSize- The number of samples to be drawn. Must be a positive integer.
 
- 
simulateDataFisherSimulates data using the model of R. A. Fisher, for a linear model. Shocks are applied every so many steps. A data point is recorded before each shock is administered. If convergence happens before that number of steps has been reached, a data point is recorded and a new shock immediately applied. The model may be cyclic. If cyclic, all eigenvalues for the coefficient matrix must be less than 1, though this is not checked.- Parameters:
- sampleSize- The number of samples to be drawn.
- intervalBetweenShocks- External shock is applied every this many steps. Must be positive integer.
- epsilon- The convergence criterion; |xi.t - xi.t-1| < epsilon.
 
- 
simulateOneRecord
- 
simulateDataNSteps
- 
getSemPm
- 
setSubstitutions
- 
setGuaranteeIidpublic void setGuaranteeIid(boolean guaranteeIid) 
 
-