Esempio n. 1
0
  @SuppressWarnings("deprecation")
  protected final void compute() {

    if (input[0].isDefined() && input[1].isDefined() && input[2].isDefined()) {
      int param = (int) Math.round(a.getDouble());
      double val = b.getDouble();
      try {
        PoissonDistribution dist = getPoissonDistribution(param);
        if (isCumulative.getBoolean()) num.setValue(dist.cumulativeProbability(val)); // P(X <= val)
        else num.setValue(dist.probability(val)); // P(X = val)
      } catch (Exception e) {
        Application.debug(e.getMessage());
        num.setUndefined();
      }
    } else num.setUndefined();
  }
Esempio n. 2
0
  @Override
  public final void compute() {

    if (input[0].isDefined() && input[1].isDefined()) {
      double param = a.getDouble();
      double val = b.getDouble();
      try {
        PoissonDistribution dist = getPoissonDistribution(param);

        double result = dist.inverseCumulativeProbability(val);

        // eg InversePascal[1,1,1] returns 2147483647
        if (result >= Integer.MAX_VALUE) num.setUndefined();
        else num.setValue(result + 1);

      } catch (Exception e) {
        num.setUndefined();
      }
    } else num.setUndefined();
  }
Esempio n. 3
0
 /**
  * @param param mean
  * @return Poisson distribution
  */
 protected PoissonDistribution getPoissonDistribution(double param) {
   if (poisson == null || poisson.getMean() != param) poisson = new PoissonDistributionImpl(param);
   return poisson;
 }