Search in sources :

Example 26 with MlBayesIm

use of edu.cmu.tetrad.bayes.MlBayesIm 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);
}
Also used : BayesProperties(edu.cmu.tetrad.bayes.BayesProperties) Graph(edu.cmu.tetrad.graph.Graph) MlBayesIm(edu.cmu.tetrad.bayes.MlBayesIm) DataSet(edu.cmu.tetrad.data.DataSet) BayesIm(edu.cmu.tetrad.bayes.BayesIm) MlBayesIm(edu.cmu.tetrad.bayes.MlBayesIm) BayesPm(edu.cmu.tetrad.bayes.BayesPm) Test(org.junit.Test)

Aggregations

MlBayesIm (edu.cmu.tetrad.bayes.MlBayesIm)26 BayesPm (edu.cmu.tetrad.bayes.BayesPm)23 BayesIm (edu.cmu.tetrad.bayes.BayesIm)20 Test (org.junit.Test)15 Graph (edu.cmu.tetrad.graph.Graph)9 Node (edu.cmu.tetrad.graph.Node)8 DataSet (edu.cmu.tetrad.data.DataSet)6 Dag (edu.cmu.tetrad.graph.Dag)6 ArrayList (java.util.ArrayList)6 LargeScaleSimulation (edu.cmu.tetrad.sem.LargeScaleSimulation)4 Algorithm (edu.cmu.tetrad.algcomparison.algorithm.Algorithm)3 GraphNode (edu.cmu.tetrad.graph.GraphNode)3 Parameters (edu.cmu.tetrad.util.Parameters)3 GeneralBootstrapTest (edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest)3 RandomGraph (edu.cmu.tetrad.algcomparison.graph.RandomGraph)2 ChiSquare (edu.cmu.tetrad.algcomparison.independence.ChiSquare)2 IndependenceWrapper (edu.cmu.tetrad.algcomparison.independence.IndependenceWrapper)2 BdeuScore (edu.cmu.tetrad.algcomparison.score.BdeuScore)2 ScoreWrapper (edu.cmu.tetrad.algcomparison.score.ScoreWrapper)2 ContinuousVariable (edu.cmu.tetrad.data.ContinuousVariable)2