use of org.knime.core.node.BufferedDataTable in project knime-core by knime.
the class OneWayANOVAStatistics method getTTestTable.
/**
* Get the test result of the t-test, for the assumption of equal
* variance and the assumption of unequal variances.
* @param exec the execution context
* @return the t-test results
*/
public BufferedDataTable getTTestTable(final ExecutionContext exec) {
DataTableSpec outSpec = getTableSpec();
BufferedDataContainer cont = exec.createDataContainer(outSpec);
int r = 0;
for (List<DataCell> cells : getTTestCells()) {
cont.addRowToTable(new DefaultRow(RowKey.createRowKey(r), cells));
r++;
}
cont.close();
BufferedDataTable outTable = cont.getTable();
return outTable;
}
use of org.knime.core.node.BufferedDataTable in project knime-core by knime.
the class OneSampleTTestStatistics method getTTestTable.
/**
* Get the test result of the t-test, for the assumption of equal
* variance and the assumption of unequal variances.
* @param exec the execution context
* @return the t-test results
*/
public BufferedDataTable getTTestTable(final ExecutionContext exec) {
DataTableSpec outSpec = getTableSpec();
BufferedDataContainer cont = exec.createDataContainer(outSpec);
int r = 0;
for (List<DataCell> cells : getTTestCells()) {
cont.addRowToTable(new DefaultRow(RowKey.createRowKey(r), cells));
r++;
}
cont.close();
BufferedDataTable outTable = cont.getTable();
return outTable;
}
use of org.knime.core.node.BufferedDataTable in project knime-core by knime.
the class OneSampleTTestStatistics method getDescStatsTable.
/**
* Get descriptive statistics
* @param exec
* @return the descriptive statistics for each column test column
*/
public BufferedDataTable getDescStatsTable(final ExecutionContext exec) {
DataTableSpec outSpec = getDescStatsSpec();
BufferedDataContainer cont = exec.createDataContainer(outSpec);
int r = 0;
for (List<DataCell> cells : getDescStatsCells()) {
cont.addRowToTable(new DefaultRow(RowKey.createRowKey(r), cells));
r++;
}
cont.close();
BufferedDataTable outTable = cont.getTable();
return outTable;
}
use of org.knime.core.node.BufferedDataTable 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 };
}
use of org.knime.core.node.BufferedDataTable in project knime-core by knime.
the class TwoSampleTTestNodeView method renderDescriptiveStatistics.
/**
* Create HTML for the descriptive statistics.
*/
private String renderDescriptiveStatistics() {
StringBuilder buffer = NodeViewUtil.createHtmlHeader();
buffer.append("<body>\n");
buffer.append("<h3>Group Statistics</h3>");
NodeViewUtil.renderDataTable(getNodeModel().getDescritiveStatistics(), TwoSampleTTestStatistics.TEST_COLUMN, Arrays.asList(new String[] { TwoSampleTTestStatistics.TEST_COLUMN, TwoSampleTTestStatistics.IGNORED_COUNT_GROUP_COL }), new HashMap<String, String>(), buffer);
BufferedDataTable descStats = getNodeModel().getDescritiveStatistics();
if (descStats.getRowCount() > 0) {
CloseableRowIterator iter = descStats.iteratorFailProve();
int ignoredIndex = descStats.getSpec().findColumnIndex(TwoSampleTTestStatistics.IGNORED_COUNT_GROUP_COL);
DataCell ignoredCell = iter.next().getCell(ignoredIndex);
if (!ignoredCell.isMissing()) {
int ignoredCount = ((IntValue) ignoredCell).getIntValue();
if (ignoredCount > 0) {
buffer.append("<p>");
buffer.append(ignoredCount);
buffer.append(ignoredCount > 1 ? " rows have been ignored. Their " : " row has been ignored. Its ");
buffer.append("value in the grouping column is neither \"");
buffer.append(getNodeModel().getSettings().getGroupOne());
buffer.append("\" nor \"");
buffer.append(getNodeModel().getSettings().getGroupTwo());
buffer.append("\".");
buffer.append("</p>");
}
}
iter.close();
}
buffer.append("</body>\n");
buffer.append("</html>\n");
return buffer.toString();
}
Aggregations