Search in sources :

Example 1 with IndTestType

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

the class PcGesSearchEditor method addMixedTestMenuItems.

private void addMixedTestMenuItems(JMenu test) {
    IndTestType testType = getTestType();
    if (testType != IndTestType.MIXED_MLR) {
        setTestType(IndTestType.MIXED_MLR);
    }
    ButtonGroup group = new ButtonGroup();
    JCheckBoxMenuItem logr = new JCheckBoxMenuItem("Multinomial Logistic Regression");
    group.add(logr);
    test.add(logr);
    logr.setSelected(true);
    logr.addActionListener(new ActionListener() {

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

Example 2 with IndTestType

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

the class PcStableLocalSearchEditor method addMultiContinuousTestMenuItems.

private void addMultiContinuousTestMenuItems(JMenu test) {
    IndTestType testType = getTestType();
    if (testType != IndTestType.POOL_RESIDUALS_FISHER_Z && testType != IndTestType.TIPPETT) {
        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 pooledResidualsFisherZ = new JCheckBoxMenuItem("Pooled Residuals (Fisher Z)");
    group.add(pooledResidualsFisherZ);
    test.add(pooledResidualsFisherZ);
    testType = getTestType();
    if (testType == IndTestType.POOL_RESIDUALS_FISHER_Z) {
        pooledResidualsFisherZ.setSelected(true);
    }
    if (testType == IndTestType.FISHER) {
        fisher.setSelected(true);
    }
    if (testType == IndTestType.TIPPETT) {
        tippett.setSelected(true);
    }
    pooledResidualsFisherZ.addActionListener(new ActionListener() {

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

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

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

Example 3 with IndTestType

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

the class MarkovBlanketSearchEditor method addContinuousTestMenuItems.

/**
 * Builds the ind test menu items for condinuous data and adds them to the given menu.
 */
private void addContinuousTestMenuItems(JMenu test) {
    IndTestType testType = (IndTestType) getParams().get("indTestType", IndTestType.FISHER_Z);
    if (testType != IndTestType.FISHER_Z && testType != IndTestType.FISHER_ZD && testType != IndTestType.FISHER_Z_BOOTSTRAP && // testType != IndTestType.CORRELATION_T &&
    testType != IndTestType.LINEAR_REGRESSION) {
        getParams().set("indTestType", IndTestType.FISHER_Z);
    }
    ButtonGroup group = new ButtonGroup();
    JCheckBoxMenuItem fishersZ = new JCheckBoxMenuItem("Fisher's Z");
    group.add(fishersZ);
    test.add(fishersZ);
    JCheckBoxMenuItem fishersZD = new JCheckBoxMenuItem("Fisher's Z - Generalized Inverse");
    group.add(fishersZD);
    test.add(fishersZD);
    JCheckBoxMenuItem fishersZBootstrap = new JCheckBoxMenuItem("Fisher's Z - Bootstrap");
    group.add(fishersZBootstrap);
    test.add(fishersZBootstrap);
    JCheckBoxMenuItem tTest = new JCheckBoxMenuItem("Cramer's T");
    group.add(tTest);
    test.add(tTest);
    JCheckBoxMenuItem linRegrTest = new JCheckBoxMenuItem("Linear Regression Test");
    group.add(linRegrTest);
    test.add(linRegrTest);
    testType = (IndTestType) getParams().get("indTestType", IndTestType.FISHER_Z);
    if (testType == IndTestType.FISHER_Z) {
        fishersZ.setSelected(true);
    } else if (testType == IndTestType.FISHER_ZD) {
        fishersZD.setSelected(true);
    } else if (testType == IndTestType.FISHER_Z_BOOTSTRAP) {
        fishersZBootstrap.setSelected(true);
    // } else if (testType == IndTestType.CORRELATION_T) {
    // tTest.setSelected(true);
    } else if (testType == IndTestType.LINEAR_REGRESSION) {
        linRegrTest.setSelected(true);
    }
    fishersZ.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            getParams().set("indTestType", IndTestType.FISHER_Z);
            JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Using Fisher's Z.");
        }
    });
    fishersZD.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            getParams().set("indTestType", IndTestType.FISHER_ZD);
            JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Using Fisher's Z - Generalized Inverse.");
        }
    });
    fishersZBootstrap.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            getParams().set("indTestType", IndTestType.FISHER_Z_BOOTSTRAP);
            JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Using Fisher's Z - Bootstrap.");
        }
    });
    // tTest.addActionListener(new ActionListener() {
    // public void actionPerformed(ActionEvent e) {
    // getParameters().setIndTestType(IndTestType.CORRELATION_T);
    // JOptionPane.showMessageDialog(JOptionUtils.centeringComp(),
    // "Using Cramer's T.");
    // }
    // });
    linRegrTest.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            getParams().set("indTestType", IndTestType.LINEAR_REGRESSION);
            JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Using linear regression test.");
        }
    });
}
Also used : IndTestType(edu.cmu.tetrad.search.IndTestType)

Example 4 with IndTestType

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

the class MarkovBlanketSearchEditor method addDiscreteTestMenuItems.

/**
 * Builds the ind test menu items for discrete data and adds them to the given menu.
 */
private void addDiscreteTestMenuItems(JMenu test) {
    IndTestType testType = (IndTestType) getParams().get("indTestType", IndTestType.FISHER_Z);
    if (testType != IndTestType.CHI_SQUARE && testType != IndTestType.G_SQUARE) {
        getParams().set("indTestType", testType);
    }
    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 (getParams().get("indTestType", IndTestType.FISHER_Z) == IndTestType.CHI_SQUARE) {
        chiSquare.setSelected(true);
    } else if (getParams().get("indTestType", IndTestType.FISHER_Z) == IndTestType.G_SQUARE) {
        gSquare.setSelected(true);
    }
    chiSquare.addActionListener(new ActionListener() {

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

        public void actionPerformed(ActionEvent e) {
            getParams().set("indTestType", IndTestType.G_SQUARE);
            JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Using G square.");
        }
    });
}
Also used : IndTestType(edu.cmu.tetrad.search.IndTestType)

Example 5 with IndTestType

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

the class MbFanSearchRunner 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