Search in sources :

Example 1 with LeveneTest

use of org.knime.base.node.stats.testing.levene.LeveneTest in project knime-core by knime.

the class TwoSampleTTestNodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected BufferedDataTable[] execute(final BufferedDataTable[] inData, final ExecutionContext exec) throws Exception {
    Map<Group, String> groups = new LinkedHashMap<Group, String>();
    groups.put(Group.GroupX, m_settings.getGroupOne());
    groups.put(Group.GroupY, m_settings.getGroupTwo());
    Grouping grouping = new StringValueGrouping(m_settings.getGroupingColumn(), groups);
    DataTableSpec spec = inData[0].getSpec();
    FilterResult filter = m_settings.getTestColumns().applyTo(spec);
    TwoSampleTTest test = new TwoSampleTTest(filter.getIncludes(), grouping, m_settings.getConfidenceIntervalProb());
    TwoSampleTTestStatistics[] result = test.execute(inData[0], exec);
    LeveneTest leveneTest = new LeveneTest(filter.getIncludes(), m_settings.getGroupingColumn(), Arrays.asList(new String[] { m_settings.getGroupOne(), m_settings.getGroupTwo() }), getGroupSummaryStats(result));
    LeveneTestStatistics[] leveneResult = leveneTest.execute(inData[0], exec);
    leveneResult[0].getTTestCells();
    m_descStats = getDescriptiveStatisticsTable(result, exec);
    m_leveneStats = getLeveneStatistices(leveneResult, exec);
    m_stats = getTestStatisticsTable(result, exec);
    return new BufferedDataTable[] { m_stats, m_leveneStats, m_descStats };
}
Also used : Group(org.knime.base.node.stats.testing.ttest.Grouping.Group) DataTableSpec(org.knime.core.data.DataTableSpec) LeveneTest(org.knime.base.node.stats.testing.levene.LeveneTest) LeveneTestStatistics(org.knime.base.node.stats.testing.levene.LeveneTestStatistics) LinkedHashMap(java.util.LinkedHashMap) BufferedDataTable(org.knime.core.node.BufferedDataTable) FilterResult(org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult)

Example 2 with LeveneTest

use of org.knime.base.node.stats.testing.levene.LeveneTest in project knime-core by knime.

the class OneWayANOVANodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected BufferedDataTable[] execute(final BufferedDataTable[] inData, final ExecutionContext exec) throws Exception {
    DataTableSpec spec = inData[0].getSpec();
    FilterResult filter = m_settings.getTestColumns().applyTo(spec);
    ExecutionMonitor groupExec = exec.createSubProgress(0.3);
    ExecutionMonitor oneWayAnovaExec = exec.createSubProgress(0.3);
    // runs twice, maybe
    ExecutionMonitor leveneExec = exec.createSubProgress(0.4);
    exec.setMessage("Determining groups");
    List<String> groups = getGroups(inData[0], groupExec);
    groupExec.setProgress(1.0);
    exec.setMessage("Computing ANOVA");
    OneWayANOVA test = new OneWayANOVA(filter.getIncludes(), m_settings.getGroupingColumn(), groups, m_settings.getConfidenceIntervalProb());
    OneWayANOVAStatistics[] result = test.execute(inData[0], oneWayAnovaExec);
    oneWayAnovaExec.setProgress(1.0);
    exec.setMessage("Computing Levene");
    LeveneTest leveneTest = new LeveneTest(filter.getIncludes(), m_settings.getGroupingColumn(), groups, getGroupSummaryStats(result));
    LeveneTestStatistics[] leveneResult = leveneTest.execute(inData[0], leveneExec);
    leveneResult[0].getTTestCells();
    leveneExec.setProgress(1.0);
    exec.setMessage("Assembling output");
    m_descStats = getDescriptiveStatisticsTable(result, exec);
    m_leveneStats = getLeveneStatistices(leveneResult, exec);
    m_stats = getTestStatisticsTable(result, exec);
    return new BufferedDataTable[] { m_stats, m_leveneStats, m_descStats };
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) LeveneTest(org.knime.base.node.stats.testing.levene.LeveneTest) BufferedDataTable(org.knime.core.node.BufferedDataTable) FilterResult(org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult) ExecutionMonitor(org.knime.core.node.ExecutionMonitor) LeveneTestStatistics(org.knime.base.node.stats.testing.levene.LeveneTestStatistics)

Aggregations

LeveneTest (org.knime.base.node.stats.testing.levene.LeveneTest)2 LeveneTestStatistics (org.knime.base.node.stats.testing.levene.LeveneTestStatistics)2 DataTableSpec (org.knime.core.data.DataTableSpec)2 BufferedDataTable (org.knime.core.node.BufferedDataTable)2 FilterResult (org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult)2 LinkedHashMap (java.util.LinkedHashMap)1 Group (org.knime.base.node.stats.testing.ttest.Grouping.Group)1 ExecutionMonitor (org.knime.core.node.ExecutionMonitor)1