Search in sources :

Example 11 with IndTestType

use of edu.cmu.tetrad.search.IndTestType in project tetrad by cmu-phil.

the class IndTestMenuItems method addGraphTestMenuItems.

private static void addGraphTestMenuItems(JMenu test, final IndTestTypeSetter setter) {
    IndTestType testType = setter.getTestType();
    if (testType != IndTestType.D_SEPARATION) {
        setter.setTestType(IndTestType.D_SEPARATION);
    }
    ButtonGroup group = new ButtonGroup();
    JCheckBoxMenuItem dsep = new JCheckBoxMenuItem("D-Separation");
    group.add(dsep);
    test.add(dsep);
    dsep.setSelected(true);
    dsep.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            setter.setTestType(IndTestType.D_SEPARATION);
        }
    });
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) IndTestType(edu.cmu.tetrad.search.IndTestType)

Example 12 with IndTestType

use of edu.cmu.tetrad.search.IndTestType in project tetrad by cmu-phil.

the class TsFciRunner method getIndependenceTest.

public IndependenceTest getIndependenceTest() {
    Object dataModel = getDataModel();
    if (dataModel == null) {
        dataModel = getSourceGraph();
    }
    Parameters params = getParams();
    IndTestType testType;
    if (getParams() instanceof Parameters) {
        Parameters _params = params;
        testType = (IndTestType) _params.get("indTestType", IndTestType.FISHER_Z);
    } else {
        Parameters _params = params;
        testType = (IndTestType) _params.get("indTestType", IndTestType.FISHER_Z);
    }
    return new IndTestChooser().getTest(dataModel, params, testType);
}
Also used : Parameters(edu.cmu.tetrad.util.Parameters) IndTestType(edu.cmu.tetrad.search.IndTestType)

Example 13 with IndTestType

use of edu.cmu.tetrad.search.IndTestType in project tetrad by cmu-phil.

the class CfciRunner method getIndependenceTest.

public IndependenceTest getIndependenceTest() {
    Object dataModel = getDataModel();
    if (dataModel == null) {
        dataModel = getSourceGraph();
    }
    Parameters params = getParams();
    IndTestType testType;
    if (getParams() instanceof Parameters) {
        Parameters _params = params;
        testType = (IndTestType) _params.get("indTestType", IndTestType.FISHER_Z);
    } else {
        Parameters _params = params;
        testType = (IndTestType) _params.get("indTestType", IndTestType.FISHER_Z);
    }
    return new IndTestChooser().getTest(dataModel, params, testType);
}
Also used : Parameters(edu.cmu.tetrad.util.Parameters) IndTestType(edu.cmu.tetrad.search.IndTestType)

Example 14 with IndTestType

use of edu.cmu.tetrad.search.IndTestType in project tetrad by cmu-phil.

the class PcStableLocalSearchEditor method addCovMatrixTestMenuItems.

private void addCovMatrixTestMenuItems(JMenu test) {
    IndTestType testType = getTestType();
    if (testType != IndTestType.FISHER_Z) // &&
    // testType != IndTestType.CORRELATION_T
    {
        setTestType(IndTestType.FISHER_Z);
    }
    ButtonGroup group = new ButtonGroup();
    JCheckBoxMenuItem fishersZ = new JCheckBoxMenuItem("Fisher's Z");
    group.add(fishersZ);
    test.add(fishersZ);
    // JCheckBoxMenuItem tTest = new JCheckBoxMenuItem("Cramer's T");
    // group.add(tTest);
    // test.add(tTest);
    testType = getTestType();
    if (testType == IndTestType.FISHER_Z) {
        fishersZ.setSelected(true);
    }
    // else if (testType == IndTestType.CORRELATION_T) {
    // tTest.setSelected(true);
    // }
    fishersZ.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            setTestType(IndTestType.FISHER_Z);
            JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Using Fisher's Z.");
        }
    });
// tTest.addActionListener(new ActionListener() {
// public void actionPerformed(ActionEvent e) {
// setTestType(IndTestType.CORRELATION_T);
// JOptionPane.showMessageDialog(JOptionUtils.centeringComp(),
// "Using Cramer's T.");
// }
// });
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) IndTestType(edu.cmu.tetrad.search.IndTestType)

Example 15 with IndTestType

use of edu.cmu.tetrad.search.IndTestType in project tetrad by cmu-phil.

the class PcStableLocalSearchEditor method addDiscreteTestMenuItems.

private void addDiscreteTestMenuItems(JMenu test) {
    IndTestType testType = getTestType();
    if (testType != IndTestType.CHI_SQUARE && testType != IndTestType.G_SQUARE) {
        setTestType(IndTestType.CHI_SQUARE);
    }
    ButtonGroup group = new ButtonGroup();
    JCheckBoxMenuItem chiSquare = new JCheckBoxMenuItem("Chi Square");
    group.add(chiSquare);
    test.add(chiSquare);
    JCheckBoxMenuItem gSquare = new JCheckBoxMenuItem("G Square");
    group.add(gSquare);
    test.add(gSquare);
    if (getTestType() == IndTestType.CHI_SQUARE) {
        chiSquare.setSelected(true);
    } else if (getTestType() == IndTestType.G_SQUARE) {
        gSquare.setSelected(true);
    }
    chiSquare.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            setTestType(IndTestType.CHI_SQUARE);
            JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Using Chi Square.");
        }
    });
    gSquare.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            setTestType(IndTestType.G_SQUARE);
            JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Using G square.");
        }
    });
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) IndTestType(edu.cmu.tetrad.search.IndTestType)

Aggregations

IndTestType (edu.cmu.tetrad.search.IndTestType)19 ActionEvent (java.awt.event.ActionEvent)10 ActionListener (java.awt.event.ActionListener)10 Parameters (edu.cmu.tetrad.util.Parameters)5