use of edu.cmu.tetrad.gene.tetradapp.model.BooleanGlassGenePm in project tetrad by cmu-phil.
the class BooleanGlassSimulation method createData.
@Override
public void createData(Parameters parameters) {
this.graph = randomGraph.createGraph(parameters);
LagGraphParams params = new LagGraphParams(parameters);
params.setIndegree(2);
params.setMlag(1);
RandomActiveLagGraph _graph = new RandomActiveLagGraph(params);
BooleanGlassGenePm pm = new BooleanGlassGenePm(_graph);
BooleanGlassGeneIm im = new BooleanGlassGeneIm(pm, parameters);
DataModelList data = im.simulateData();
List<DataSet> dataSets = new ArrayList<>();
for (DataModel model : data) {
dataSets.add((DataSet) model);
}
this.dataSets = dataSets;
List<String> factors = new ArrayList<>(_graph.getFactors());
Map<String, Node> nodes = new HashMap<>();
for (String factor : factors) {
nodes.put(factor, new ContinuousVariable(factor));
}
TimeLagGraph graph = new TimeLagGraph();
graph.setMaxLag(_graph.getMaxLag());
for (String factor : factors) {
graph.addNode(nodes.get(factor));
}
for (String factor : factors) {
for (Object o : _graph.getParents(factor)) {
LaggedFactor laggedFactor = (LaggedFactor) o;
String _factor = laggedFactor.getFactor();
int lag = laggedFactor.getLag();
Node node1 = graph.getNode(_factor + ":" + lag);
Node node2 = graph.getNode(factor);
graph.addDirectedEdge(node1, node2);
}
}
topToBottomLayout(graph);
this.graph = graph;
}
Aggregations