コード例 #1
0
  protected void plotParameterPlane() {
    double x1 = x.getElement(0);
    double x2 = x.getElement(1);
    double dx1 = Math.sqrt(cx.getElement(0, 0));
    double dx2 = Math.sqrt(cx.getElement(1, 1));
    double rho = (cx.getElement(1, 0)) / (dx1 * dx2);
    // prepare size of plot
    double xmin = x1 - 2. * dx1;
    double xmax = x1 + 2. * dx1;
    double ymin = x2 - 2. * dx2;
    double ymax = x2 + 2. * dx2;
    DatanGraphics.openWorkstation(getClass().getName(), "E3Min_2.ps");
    DatanGraphics.setFormat(0., 0.);
    DatanGraphics.setWindowInComputingCoordinates(xmin, xmax, ymin, ymax);
    DatanGraphics.setViewportInWorldCoordinates(.2, .9, .16, .86);
    DatanGraphics.setWindowInWorldCoordinates(-.414, 1., 0., 1.);
    DatanGraphics.setBigClippingWindow();
    DatanGraphics.chooseColor(2);
    DatanGraphics.drawFrame();
    DatanGraphics.drawScaleX("x_1");
    DatanGraphics.drawScaleY("x_2");
    DatanGraphics.drawBoundary();
    DatanGraphics.chooseColor(5);
    // draw data point with errors (and correlation)
    DatanGraphics.drawDatapoint(1, 1., x1, x2, dx1, dx2, rho);
    DatanGraphics.chooseColor(2);
    DatanGraphics.drawCaption(1., caption);
    // draw confidence contour
    double fcont = mllg.getValue(x) + .5;
    int nx = 100;
    int ny = 100;
    double dx = (xmax - xmin) / (int) nx;
    double dy = (ymax - ymin) / (int) ny;
    MinLogLikeGaussCont mllgc = new MinLogLikeGaussCont();
    //      System.out.println(" x = " + x.toString() + ", mllgc.getValue(x) = " +
    // mllgc.getValue(x.getElement(0), x.getElement(1)));
    DatanGraphics.setBigClippingWindow();
    DatanGraphics.chooseColor(1);
    DatanGraphics.drawContour(xmin, ymin, dx, dy, nx, ny, fcont, mllgc);
    // draw asymmetric errors as horiyontal and vertical bars
    DatanGraphics.chooseColor(3);
    double[] xpl = new double[2];
    double[] ypl = new double[2];
    for (int i = 0; i < 2; i++) {
      if (i == 0) xpl[0] = x1 - dxasy[0][0];
      else xpl[0] = x1 + dxasy[0][1];
      xpl[1] = xpl[0];
      ypl[0] = ymin;
      ypl[1] = ymax;
      DatanGraphics.drawPolyline(xpl, ypl);
    }
    for (int i = 0; i < 2; i++) {
      if (i == 0) ypl[0] = x2 - dxasy[1][0];
      else ypl[0] = x2 + dxasy[1][1];
      ypl[1] = ypl[0];
      xpl[0] = xmin;
      xpl[1] = xmax;
      DatanGraphics.drawPolyline(xpl, ypl);
    }

    DatanGraphics.closeWorkstation();
  }