Search in sources :

Example 16 with IndTestType

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

the class IndTestMenuItems method addMultiTestMenuItems.

private static void addMultiTestMenuItems(JMenu test, final IndTestTypeSetter setter) {
    IndTestType testType = setter.getTestType();
    if (testType != IndTestType.POOL_RESIDUALS_FISHER_Z && testType != IndTestType.TIPPETT && testType != IndTestType.FISHER && testType != IndTestType.SEM_BIC) {
        setter.setTestType(IndTestType.POOL_RESIDUALS_FISHER_Z);
    }
    ButtonGroup group = new ButtonGroup();
    JCheckBoxMenuItem fisher = new JCheckBoxMenuItem("Fisher (Fisher Z)");
    group.add(fisher);
    test.add(fisher);
    JCheckBoxMenuItem tippett = new JCheckBoxMenuItem("Tippett (Fisher Z)");
    group.add(tippett);
    test.add(tippett);
    JCheckBoxMenuItem fisherZPoolResiduals = new JCheckBoxMenuItem("Pool Residuals (Fisher Z)");
    group.add(fisherZPoolResiduals);
    test.add(fisherZPoolResiduals);
    JCheckBoxMenuItem bicBump = new JCheckBoxMenuItem("BIC Bump (IMaGES)");
    group.add(bicBump);
    test.add(bicBump);
    testType = setter.getTestType();
    if (testType == IndTestType.POOL_RESIDUALS_FISHER_Z) {
        fisherZPoolResiduals.setSelected(true);
    }
    if (testType == IndTestType.FISHER) {
        fisher.setSelected(true);
    }
    if (testType == IndTestType.TIPPETT) {
        tippett.setSelected(true);
    }
    if (testType == IndTestType.SEM_BIC) {
        bicBump.setSelected(true);
    }
    fisherZPoolResiduals.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            setter.setTestType(IndTestType.POOL_RESIDUALS_FISHER_Z);
            JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Using Pooled Residuals Fisher Z");
        }
    });
    fisher.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            setter.setTestType(IndTestType.FISHER);
            JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Using Fisher");
        }
    });
    tippett.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            setter.setTestType(IndTestType.TIPPETT);
            JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Using Tippett");
        }
    });
    bicBump.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            setter.setTestType(IndTestType.SEM_BIC);
            JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Using BIC Bump (IMaGES)");
        }
    });
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) IndTestType(edu.cmu.tetrad.search.IndTestType)

Example 17 with IndTestType

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

the class IndTestMenuItems method addCovMatrixTestMenuItems.

private static void addCovMatrixTestMenuItems(JMenu test, final IndTestTypeSetter setter) {
    IndTestType testType = setter.getTestType();
    if (testType != IndTestType.FISHER_Z) // &&
    // testType != IndTestType.CORRELATION_T
    {
        setter.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 = setter.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) {
            setter.setTestType(IndTestType.FISHER_Z);
            JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Using Fisher's Z.");
        }
    });
// tTest.addActionListener(new ActionListener() {
// public void actionPerformed(ActionEvent e) {
// setter.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 18 with IndTestType

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

the class IndTestMenuItems method addDiscreteTestMenuItems.

static void addDiscreteTestMenuItems(JMenu test, final IndTestTypeSetter setter) {
    IndTestType testType = setter.getTestType();
    if (testType != IndTestType.CHI_SQUARE && testType != IndTestType.G_SQUARE && testType != IndTestType.MIXED_MLR) {
        setter.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);
    JCheckBoxMenuItem logr = new JCheckBoxMenuItem("Multinomial Logistic Regression");
    group.add(logr);
    test.add(logr);
    // 
    if (setter.getTestType() == IndTestType.CHI_SQUARE) {
        chiSquare.setSelected(true);
    } else if (setter.getTestType() == IndTestType.G_SQUARE) {
        gSquare.setSelected(true);
    } else if (setter.getTestType() == IndTestType.MIXED_MLR) {
        logr.setSelected(true);
    }
    chiSquare.addActionListener(new ActionListener() {

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

        public void actionPerformed(ActionEvent e) {
            setter.setTestType(IndTestType.G_SQUARE);
            JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Using G square.");
        }
    });
    logr.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            setter.setTestType(IndTestType.MIXED_MLR);
            JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Using multinomial logistic regression test.");
        }
    });
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) IndTestType(edu.cmu.tetrad.search.IndTestType)

Example 19 with IndTestType

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

the class HitonRunner method getIndependenceTest.

public IndependenceTest getIndependenceTest() {
    Object dataModel = getDataModel();
    if (dataModel == null) {
        dataModel = getSourceGraph();
    }
    Parameters params = getParams();
    IndTestType 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)

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