use of edu.cmu.tetrad.bayes.BayesIm in project tetrad by cmu-phil.
the class TestBayesBicScorer method testPValue.
@Test
public void testPValue() {
RandomUtil.getInstance().setSeed(492834924L);
// Graph graph = GraphConverter.convert("X1,X2,X4,X4,X5,X6,X7,X8");
Graph graph = GraphConverter.convert("X1-->X2,X2-->X3,X3-->X6,X6-->X7");
// Graph graph2 = GraphConverter.convert("X1,X2,X3,X7-->X6,X9,X10,X11,X12");
int numCategories = 8;
BayesPm pm = new BayesPm(graph, numCategories, numCategories);
BayesIm im = new MlBayesIm(pm, MlBayesIm.RANDOM);
DataSet data = im.simulateData(1000, false);
BayesProperties scorer = new BayesProperties(data);
double lik = scorer.getLikelihoodRatioP(graph);
assertEquals(1, lik, 0.001);
}
Aggregations