コード例 #1
0
  public static TextTable getVTextTable(SingleARIMAModel model) {
    TextTable table = new TextTable();
    double[] phi = model.getPhi();
    double[] standardError = model.getSe();
    double[] theta = model.getTheta();
    double intercept = model.getIntercept();
    int ncxreg = model.getNcxreg();

    table.addLine(new String[] {"Column", "Coefficient", "SE"});

    if (ncxreg > 0) {
      table.addLine(
          new String[] {
            "Intercept",
            AlpineMath.powExpression(intercept),
            AlpineMath.powExpression(standardError[standardError.length - 1])
          });
    }
    for (int i = 0; i < phi.length; i++) {
      table.addLine(
          new String[] {
            "AR" + i, AlpineMath.powExpression(phi[i]), AlpineMath.powExpression(standardError[i])
          });
    }
    for (int i = 0; i < theta.length; i++) {
      table.addLine(
          new String[] {
            "MA" + i,
            AlpineMath.powExpression(theta[i]),
            AlpineMath.powExpression(standardError[i + phi.length])
          });
    }

    return table;
  }
コード例 #2
0
 private void generateTableEntity(TextTable table, TableEntity te) {
   for (int i = 0; i < table.getLines().size(); i++) {
     if (i == 0) {
       te.setColumn(table.getLines().get(i));
       for (int j = 0; j < te.getColumn().length; j++) {
         if (j == 0) {
           te.addSortColumn(te.getColumn()[j], DataTypeConverterUtil.textType);
         } else {
           te.addSortColumn(te.getColumn()[j], DataTypeConverterUtil.numberType);
         }
       }
     } else {
       te.addItem(table.getLines().get(i));
     }
   }
 }
コード例 #3
0
  @Override
  public String toString() {
    int numColumns = getColumnCount();
    TextTable table = new TextTable();
    String[] columnNames = new String[numColumns];

    for (int c = 0; c < getColumnCount(); c++) {
      columnNames[c] = getColumnName(c);
    }
    table.addHeader(columnNames);

    int numRows = getRowCount();
    for (int r = 0; r < numRows; r++) {
      String[] columnValues = new String[numColumns];
      for (int c = 0; c < getColumnCount(); c++) {
        columnValues[c] = getString(r, c);
      }
      table.addRow(columnValues);
    }
    return table.toString();
  }