Search in sources :

Example 51 with DataCell

use of org.knime.core.data.DataCell in project knime-core by knime.

the class OneSampleTTestStatistics method getDescStats.

/**
 * Get descriptive statistics for the given column
 * @param rowID the row key
 * @param column the name of the column
 * @param stats the statistics of the column
 * @param missing the missing values in this column
 * @return a DataRow with descriptive statistics
 */
private List<DataCell> getDescStats(final String column, final SummaryStatistics stats, final MutableInteger missing) {
    List<DataCell> cells = new ArrayList<DataCell>();
    cells.add(new StringCell(column));
    cells.add(new IntCell((int) stats.getN()));
    cells.add(new IntCell(missing.intValue()));
    cells.add(new DoubleCell(stats.getMean()));
    cells.add(new DoubleCell(stats.getStandardDeviation()));
    cells.add(new DoubleCell(StatsUtil.getStandardError(stats)));
    return cells;
}
Also used : StringCell(org.knime.core.data.def.StringCell) DoubleCell(org.knime.core.data.def.DoubleCell) ArrayList(java.util.ArrayList) DataCell(org.knime.core.data.DataCell) IntCell(org.knime.core.data.def.IntCell)

Example 52 with DataCell

use of org.knime.core.data.DataCell in project knime-core by knime.

the class PairedTTestNodeModel method getDescriptiveStatisticsTable.

/**
 * Get table with descriptive statistics
 * @param result test statistic
 * @param exec the exection context
 * @return a combined table of the test statistic
 */
private BufferedDataTable getDescriptiveStatisticsTable(final PairedTTestStatistics[] result, final ExecutionContext exec) {
    BufferedDataContainer cont = exec.createDataContainer(PairedTTestStatistics.getDescStatsSpec());
    int r = 0;
    for (int i = 0; i < result.length; i++) {
        for (List<DataCell> cells : result[i].getDescStatsCells()) {
            cont.addRowToTable(new DefaultRow(RowKey.createRowKey(r), cells));
            r++;
        }
    }
    cont.close();
    return cont.getTable();
}
Also used : BufferedDataContainer(org.knime.core.node.BufferedDataContainer) DataCell(org.knime.core.data.DataCell) DefaultRow(org.knime.core.data.def.DefaultRow)

Example 53 with DataCell

use of org.knime.core.data.DataCell in project knime-core by knime.

the class PairedTTestNodeModel method getTestStatisticsTable.

/**
 * Get table with test statistics
 * @param result test statistic
 * @param exec the exection context
 * @return a combined table of the test statistic
 */
private BufferedDataTable getTestStatisticsTable(final PairedTTestStatistics[] result, final ExecutionContext exec) {
    BufferedDataContainer cont = exec.createDataContainer(PairedTTestStatistics.getTableSpec());
    int r = 0;
    for (int i = 0; i < result.length; i++) {
        for (List<DataCell> cells : result[i].getTTestCells()) {
            cont.addRowToTable(new DefaultRow(RowKey.createRowKey(r), cells));
            r++;
        }
    }
    cont.close();
    return cont.getTable();
}
Also used : BufferedDataContainer(org.knime.core.node.BufferedDataContainer) DataCell(org.knime.core.data.DataCell) DefaultRow(org.knime.core.data.def.DefaultRow)

Example 54 with DataCell

use of org.knime.core.data.DataCell in project knime-core by knime.

the class TwoSampleTTestNodeDialog method initGroupComboBoxes.

private void initGroupComboBoxes(final JComboBox groupOne) {
    Object selected = groupOne.getSelectedItem();
    groupOne.removeAllItems();
    String col = m_groupingColumn.getSelectedColumn();
    if (col != null && m_spec.containsName(col)) {
        DataColumnSpec colSpec = m_spec.getColumnSpec(col);
        DataColumnDomain domain = colSpec.getDomain();
        if (domain.hasValues()) {
            for (DataCell cell : domain.getValues()) {
                groupOne.addItem(cell.toString());
            }
        } else if (domain.hasBounds()) {
            groupOne.addItem(domain.getLowerBound().toString());
            groupOne.addItem(domain.getUpperBound().toString());
        }
    }
    groupOne.setSelectedItem(selected);
}
Also used : DataColumnSpec(org.knime.core.data.DataColumnSpec) DataColumnDomain(org.knime.core.data.DataColumnDomain) DataCell(org.knime.core.data.DataCell)

Example 55 with DataCell

use of org.knime.core.data.DataCell in project knime-core by knime.

the class TwoSampleTTestNodeModel method getLeveneStatistices.

/**
 * Get the table with the Levene-Test statistics
 * @param leveneResult the Levene-Test results
 * @param exec the execution context
 * @return the table with the Levene-Test statistics
 */
private BufferedDataTable getLeveneStatistices(final LeveneTestStatistics[] leveneResult, final ExecutionContext exec) {
    BufferedDataContainer cont = exec.createDataContainer(LeveneTestStatistics.getTableSpec());
    int r = 0;
    for (int i = 0; i < leveneResult.length; i++) {
        for (List<DataCell> cells : leveneResult[i].getTTestCells()) {
            cont.addRowToTable(new DefaultRow(RowKey.createRowKey(r), cells));
            r++;
        }
    }
    cont.close();
    return cont.getTable();
}
Also used : BufferedDataContainer(org.knime.core.node.BufferedDataContainer) DataCell(org.knime.core.data.DataCell) DefaultRow(org.knime.core.data.def.DefaultRow)

Aggregations

DataCell (org.knime.core.data.DataCell)780 DataRow (org.knime.core.data.DataRow)268 DataTableSpec (org.knime.core.data.DataTableSpec)175 DataColumnSpec (org.knime.core.data.DataColumnSpec)170 DefaultRow (org.knime.core.data.def.DefaultRow)169 ArrayList (java.util.ArrayList)141 StringCell (org.knime.core.data.def.StringCell)131 DoubleCell (org.knime.core.data.def.DoubleCell)129 DoubleValue (org.knime.core.data.DoubleValue)111 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)109 DataType (org.knime.core.data.DataType)97 RowKey (org.knime.core.data.RowKey)94 BufferedDataTable (org.knime.core.node.BufferedDataTable)93 BufferedDataContainer (org.knime.core.node.BufferedDataContainer)91 DataColumnSpecCreator (org.knime.core.data.DataColumnSpecCreator)84 LinkedHashMap (java.util.LinkedHashMap)81 IntCell (org.knime.core.data.def.IntCell)79 HashMap (java.util.HashMap)60 SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)57 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)56