@Test
  public void testPDF() throws Exception {
    System.out.println("Testing 10000 random pdf calls");
    LogNormalDistributionModel logNormal = new LogNormalDistributionModel();
    logNormal.init("1.0", "2.0");

    for (int i = 0; i < 10000; i++) {
      double M = Math.random() * 10.0 - 5.0;
      double S = Math.random() * 10;

      double x = -1;
      while (x < 0) {
        x = Math.log(Math.random() * 10);
      }

      logNormal.MParameterInput.setValue(M + "", logNormal);
      logNormal.SParameterInput.setValue(S + "", logNormal);
      logNormal.initAndValidate();

      double pdf =
          1.0
              / (x * S * Math.sqrt(2 * Math.PI))
              * Math.exp(-Math.pow(Math.log(x) - M, 2) / (2 * S * S));

      System.out.println("Testing logNormal[M=" + M + " S=" + S + "].pdf(" + x + ")");
      double f = logNormal.density(x);

      assertEquals(pdf, f, 1e-10);
    }
  }
  @Test
  public void testCalcLogP() throws Exception {
    LogNormalDistributionModel logNormal = new LogNormalDistributionModel();
    logNormal.hasMeanInRealSpaceInput.setValue("true", logNormal);
    logNormal.offsetInput.setValue("1200", logNormal);
    logNormal.MParameterInput.setValue("2000", logNormal);
    logNormal.SParameterInput.setValue("0.6", logNormal);
    logNormal.initAndValidate();
    RealParameter p = new RealParameter(new Double[] {2952.6747000000014});

    double f0 = logNormal.calcLogP(p);
    assertEquals(-7.880210654973873, f0, 1e-10);
  }