Search in sources :

Example 46 with DataCell

use of org.knime.core.data.DataCell 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;
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) BufferedDataContainer(org.knime.core.node.BufferedDataContainer) BufferedDataTable(org.knime.core.node.BufferedDataTable) DataCell(org.knime.core.data.DataCell) DefaultRow(org.knime.core.data.def.DefaultRow)

Example 47 with DataCell

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

the class OneWayANOVAStatistics method getGroupsTotalStatistics.

/**
 * Get descriptive statistics for all groups.
 * @return the descriptive statistics for all groups
 */
public List<DataCell> getGroupsTotalStatistics() {
    List<DataCell> cells = new ArrayList<DataCell>();
    cells.add(new StringCell(m_column));
    cells.add(new StringCell("Total"));
    SummaryStatistics stats = m_stats;
    cells.add(new IntCell((int) stats.getN()));
    int missingCount = 0;
    for (MutableInteger m : m_missing) {
        missingCount += m.intValue();
    }
    cells.add(new IntCell(missingCount));
    cells.add(new IntCell(m_missingGroup.intValue()));
    cells.add(new DoubleCell(stats.getMean()));
    cells.add(new DoubleCell(stats.getStandardDeviation()));
    cells.add(new DoubleCell(StatsUtil.getStandardError(stats)));
    cells.add(new DoubleCell(m_confidenceIntervalProp));
    long df = stats.getN() - 1;
    TDistribution distribution = new TDistribution(df);
    double tValue = FastMath.abs(distribution.inverseCumulativeProbability((1 - m_confidenceIntervalProp) / 2));
    double confidenceDelta = tValue * StatsUtil.getStandardError(stats);
    double confidenceLowerBound = stats.getMean() - confidenceDelta;
    double confidenceUpperBound = stats.getMean() + confidenceDelta;
    cells.add(new DoubleCell(confidenceLowerBound));
    cells.add(new DoubleCell(confidenceUpperBound));
    cells.add(new DoubleCell(stats.getMin()));
    cells.add(new DoubleCell(stats.getMax()));
    return cells;
}
Also used : StringCell(org.knime.core.data.def.StringCell) DoubleCell(org.knime.core.data.def.DoubleCell) MutableInteger(org.knime.core.util.MutableInteger) ArrayList(java.util.ArrayList) DataCell(org.knime.core.data.DataCell) SummaryStatistics(org.apache.commons.math3.stat.descriptive.SummaryStatistics) TDistribution(org.apache.commons.math3.distribution.TDistribution) IntCell(org.knime.core.data.def.IntCell)

Example 48 with DataCell

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

the class OneWayANOVAStatistics method getTotal.

/**
 * Get the row of the ANOVA table with the cells "Total".
 */
private List<DataCell> getTotal(final ANOVA anova) {
    List<DataCell> cells = new ArrayList<DataCell>();
    cells.add(new StringCell(m_column));
    cells.add(new StringCell(SOURCE_TOTAL));
    cells.add(new DoubleCell(anova.getSqurb() + anova.getSquri()));
    cells.add(new IntCell((int) (anova.getDfb() + anova.getDfi())));
    cells.add(DataType.getMissingCell());
    cells.add(DataType.getMissingCell());
    cells.add(DataType.getMissingCell());
    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 49 with DataCell

use of org.knime.core.data.DataCell 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;
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) BufferedDataContainer(org.knime.core.node.BufferedDataContainer) BufferedDataTable(org.knime.core.node.BufferedDataTable) DataCell(org.knime.core.data.DataCell) DefaultRow(org.knime.core.data.def.DefaultRow)

Example 50 with DataCell

use of org.knime.core.data.DataCell 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;
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) BufferedDataContainer(org.knime.core.node.BufferedDataContainer) BufferedDataTable(org.knime.core.node.BufferedDataTable) 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