Package edu.cmu.tetrad.sem
Class LargeScaleSimulation
java.lang.Object
edu.cmu.tetrad.sem.LargeScaleSimulation
Stores a SEM model, pared down, for purposes of simulating data sets with
 large numbers of variables and sample sizes.
- Author:
- Joseph Ramsey
- 
Constructor SummaryConstructorsConstructorDescriptionLargeScaleSimulation(Graph graph) LargeScaleSimulation(Graph graph, List<Node> nodes, int[] tierIndices) 
- 
Method SummaryModifier and TypeMethodDescriptiondouble[][]getGraph()static intgetKnowledge(Graph graph) static intgetNameNoLag(Object obj) getOut()static Stringdoubledouble[][]getSoCalledPoissonShocks(int sampleSize) double[][]getUncorrelatedShocks(int sampleSize) booleanvoidsetCoefRange(double coefLow, double coefHigh) voidsetErrorsNormal(boolean errorsNormal) voidsetIncludeNegativeCoefs(boolean includeNegativeCoefs) voidsetIncludePositiveCoefs(boolean includePositiveCoefs) voidsetMeanRange(double meanLow, double meanHigh) voidsetOut(PrintStream out) voidsetSelfLoopCoef(double selfLoopCoef) voidsetVarRange(double varLow, double varHigh) voidsetVerbose(boolean verbose) simulateDataFisher(double[][] shocks, int intervalBetweenShocks, double epsilon) Simulates data using the model of R.simulateDataFisher(int sampleSize) Simulates data using the model of R.simulateDataFisher(int intervalBetweenShocks, int intervalBetweenRecordings, int sampleSize, double epsilon, boolean saveLatentVars) simulateDataRecursive(int sampleSize) This simulates data by picking random values for the exogenous terms and percolating this information down through the SEM, assuming it is acyclic.simulateDataReducedForm(int sampleSize) Simulates data using the model X = (I - B)Y^-1 * e.
- 
Constructor Details- 
LargeScaleSimulation
- 
LargeScaleSimulation
 
- 
- 
Method Details- 
simulateDataRecursiveThis simulates data by picking random values for the exogenous terms and percolating this information down through the SEM, assuming it is acyclic. Works, but will hang for cyclic models, and is very slow for large numbers of variables (probably due to the heavyweight lookups of various values--could be improved). The model must be acyclic, or else this will spin.
- 
simulateDataReducedFormSimulates data using the model X = (I - B)Y^-1 * e. Errors are uncorrelated.- Parameters:
- sampleSize- The nubmer of samples to draw.
 
- 
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:
- shocks- A matrix of shocks. The value at shocks[i][j] is the shock for the i'th time step, for the j'th variables.
- intervalBetweenShocks- External shock is applied every this many steps. Must be positive integer.
- epsilon- The convergence criterion; |xi.t - xi.t-1| < epsilon.fff
 
- 
simulateDataFisherpublic DataSet simulateDataFisher(int intervalBetweenShocks, int intervalBetweenRecordings, int sampleSize, double epsilon, boolean saveLatentVars) 
- 
getGraph
- 
setCoefRangepublic void setCoefRange(double coefLow, double coefHigh) 
- 
setVarRangepublic void setVarRange(double varLow, double varHigh) 
- 
setMeanRangepublic void setMeanRange(double meanLow, double meanHigh) 
- 
setOut
- 
getOut
- 
isVerbosepublic boolean isVerbose()
- 
setVerbosepublic void setVerbose(boolean verbose) 
- 
getCoefficientMatrixpublic double[][] getCoefficientMatrix()
- 
getVariableNodes
- 
getNameNoLag
- 
getKnowledge
- 
getPrefix
- 
getIndex
- 
getLag
- 
getSoCalledPoissonShockspublic double[][] getSoCalledPoissonShocks(int sampleSize) 
- 
setIncludePositiveCoefspublic void setIncludePositiveCoefs(boolean includePositiveCoefs) 
- 
setIncludeNegativeCoefspublic void setIncludeNegativeCoefs(boolean includeNegativeCoefs) 
- 
setErrorsNormalpublic void setErrorsNormal(boolean errorsNormal) 
- 
getSelfLoopCoefpublic double getSelfLoopCoef()
- 
setSelfLoopCoefpublic void setSelfLoopCoef(double selfLoopCoef) 
 
-