コード例 #1
0
  /**
   * @param stream
   * @throws IOException
   */
  public void StableSeasonalityTest(HtmlStream stream) throws IOException {
    stream
        .write(HtmlTag.HEADER1, h1, "Test for the presence of seasonality assuming stability")
        .newLine();
    SeasonalityTest stest = m_stests.getStableSeasonality();

    stream.open(new HtmlTable(0, 400));
    stream.open(HtmlTag.TABLEROW);
    stream.write(new HtmlTableCell("", 100));
    stream.write(new HtmlTableCell("Sum of squares", 100));
    stream.write(new HtmlTableCell("Degrees of freedom", 100));
    stream.write(new HtmlTableCell("Mean square", 100));
    stream.close(HtmlTag.TABLEROW);

    stream.open(HtmlTag.TABLEROW);
    stream.write(new HtmlTableCell("Between months", 100, HtmlStyle.Italic));
    stream.write(new HtmlTableCell(Double.toString(stest.getSSM()), 100));
    stream.write(new HtmlTableCell(Double.toString(stest.getDFInterPeriod()), 100));
    stream.write(
        new HtmlTableCell(Double.toString(stest.getSSM() / stest.getDFInterPeriod()), 100));
    stream.close(HtmlTag.TABLEROW);

    stream.open(HtmlTag.TABLEROW);
    stream.write(new HtmlTableCell("Residual", 100, HtmlStyle.Italic));
    stream.write(new HtmlTableCell(Double.toString(stest.getSSR()), 100));
    stream.write(new HtmlTableCell(Double.toString(stest.getDFResidual()), 100));
    stream.write(new HtmlTableCell(Double.toString(stest.getSSR() / stest.getDFResidual()), 100));
    stream.close(HtmlTag.TABLEROW);

    stream.open(HtmlTag.TABLEROW);
    stream.write(new HtmlTableCell("Total", 100, HtmlStyle.Italic));
    stream.write(new HtmlTableCell(Double.toString(stest.getSSQ()), 100));
    stream.write(new HtmlTableCell(Double.toString(stest.getDFTot()), 100));
    stream.write(new HtmlTableCell(Double.toString(stest.getSSQ() / stest.getDFTot()), 100));
    stream.close(HtmlTag.TABLEROW);
    stream.close(HtmlTag.TABLE).newLine();

    stream.write("Value: " + stest.getValue()).newLine();
    stream.write("Distribution: " + stest.getDistribution().getDescription()).newLine();
    stream.write("PValue: " + df4.format(stest.getPValue()), PValue(stest.getPValue())).newLine();
    if (stest.getPValue() < 0.01) {
      stream.write("Seasonality present at the 1 per cent level").newLines(2);
    } else if (stest.getPValue() > 0.05) {
      stream
          .write("No evidence of seasonality at the 5 per cent level", HtmlStyle.Bold)
          .newLines(2);
    }
  }
コード例 #2
0
  /**
   * @param stream
   * @throws IOException
   */
  public void EvolutionSeasonalityTest(HtmlStream stream) throws IOException {
    stream.write(HtmlTag.HEADER1, h1, "Evolutive seasonality test").newLine();
    SeasonalityTest stest = m_stests.getEvolutiveSeasonality();

    stream.open(new HtmlTable(0, 400));
    stream.open(HtmlTag.TABLEROW);
    stream.write(new HtmlTableCell("", 100));
    stream.write(new HtmlTableCell("Sum of squares", 100));
    stream.write(new HtmlTableCell("Degrees of freedom", 100));
    stream.write(new HtmlTableCell("Mean square", 100));
    stream.close(HtmlTag.TABLEROW);

    stream.open(HtmlTag.TABLEROW);
    stream.write(new HtmlTableCell("Between years", 100, HtmlStyle.Italic));
    stream.write(new HtmlTableCell(Double.toString(stest.getSSM()), 100));
    stream.write(new HtmlTableCell(Double.toString(stest.getDFInterPeriod()), 100));
    stream.write(
        new HtmlTableCell(Double.toString(stest.getSSM() / stest.getDFInterPeriod()), 100));
    stream.close(HtmlTag.TABLEROW);

    stream.open(HtmlTag.TABLEROW);
    stream.write(new HtmlTableCell("Error", 100, HtmlStyle.Italic));
    stream.write(new HtmlTableCell(Double.toString(stest.getSSR()), 100));
    stream.write(new HtmlTableCell(Double.toString(stest.getDFResidual()), 100));
    stream.write(new HtmlTableCell(Double.toString(stest.getSSR() / stest.getDFResidual()), 100));
    stream.close(HtmlTag.TABLE).newLines(2);

    stream.write("Value: " + stest.getValue()).newLine();
    stream.write("Distribution: " + stest.getDistribution().getDescription()).newLine();
    stream
        .write("PValue: " + df4.format(stest.getPValue()), RPValue(stest.getPValue(), 0.01, 0.05))
        .newLine();
    if (stest.getPValue() > 0.2) {
      stream.write("No evidence of moving seasonality at the 20 per cent level").newLines(2);
    } else if (stest.getPValue() < 0.05) {
      stream
          .write("Moving seasonality present at the 5 per cent level", HtmlStyle.Bold)
          .newLines(2);
    }
  }