public void determineVariableNames() { variableNames = new ArrayList<String>(); List<String> columnNames = data.getColumnNames(); for (String columnName : columnNames) { String variableName = columnName.replaceAll("[\\W||[\\d]]", ""); if (!variableName.equalsIgnoreCase("ITERATIONS") && !variableNames.contains(variableName)) { variableNames.add(variableName); } } }
public void calculateStatistics() { for (String variableName : variableNames) { List<Integer> selectedColumns = new ArrayList<Integer>(); List<String> columnNames = data.getColumnNames(); int size = columnNames.size(); for (int i = 0; i < size; i++) { String columnName = columnNames.get(i); // if necesary strip the sample number: (X) if (columnName.contains("(")) { columnName = columnName.substring(0, columnName.indexOf("(") - 1); } if (columnName.compareTo(variableName) == 0) { selectedColumns.add(i); } } DescriptiveStatsCalculator calculator = new DescriptiveStatsCalculator((StandardDataTable<Numeric>) data, selectedColumns); calculator.calculate(); variableToStatsMap.put(variableName, calculator.getIterationsDescriptiveStatistics()); } }
@Override public List<Numeric> getBottomRow() { return data.getRow(data.getNumRows() - 1); }
@Override public List<Numeric> getIterationColumn() { return data.getColumn(0); }