Class ErrorCalculationMethod

java.lang.Object
net.simplace.sim.util.statistics.ErrorCalculationMethod
Direct Known Subclasses:
AgreementIndex, Bias, ConcordanceCorrelationCoefficient, CorrelationCoefficient, EF, MAE, MRE, MSE, RMAE, RMSE, RRMSE, SMAPE, VoidErrorCalculator

public abstract class ErrorCalculationMethod extends Object
Base class of the error calculation methods (goodness-of-fit measures) used by the selectors (e.g. LeastDifferenceSelector) and the output statistics. Pairs of observed and calculated values are accumulated with addDataPair(double, double); getValue() returns the measure, and isBetter(double, double) compares two values of the measure. Instances are created by ErrorCalculationFactory.
Author:
Gunther Krauss
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    number of data pairs added
    protected double
    accumulated sum (meaning depends on the method)
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    addDataPair(double observed, double calculated)
    Adds a pair of observed and calculated values.
     
    abstract String
     
    abstract double
    Calculates the measure from the added pairs.
    double
    Returns the value that is considered worst by the error calculation method (the start value when searching the best value).
    void
    Resets the accumulated data for a new calculation.
    abstract boolean
    isBetter(double better, double worse)
    Checks if the first value is better than the second one with respect to the calculation method (e.g.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • count

      protected int count
      number of data pairs added
    • sum

      protected double sum
      accumulated sum (meaning depends on the method)
  • Constructor Details

    • ErrorCalculationMethod

      public ErrorCalculationMethod()
  • Method Details

    • init

      public void init()
      Resets the accumulated data for a new calculation.
    • getWorstValue

      public double getWorstValue()
      Returns the value that is considered worst by the error calculation method (the start value when searching the best value).
      Returns:
      the worst value, Double.MAX_VALUE by default
    • addDataPair

      public abstract void addDataPair(double observed, double calculated)
      Adds a pair of observed and calculated values.
      Parameters:
      observed - the observed (measured) value
      calculated - the calculated (simulated) value
    • getValue

      public abstract double getValue()
      Calculates the measure from the added pairs.
      Returns:
      the value of the measure (the worst value if no pairs were added)
    • isBetter

      public abstract boolean isBetter(double better, double worse)
      Checks if the first value is better than the second one with respect to the calculation method (e.g. smaller for errors, closer to 1 for model efficiency).
      Parameters:
      better - the value that is checked to be better
      worse - the value to compare with
      Returns:
      true if the first value is better than the second
    • getLabel

      public abstract String getLabel()
      Returns:
      the label (abbreviation) of the calculation method, e.g. RMSE
    • getDescription

      public String getDescription()
      Returns:
      the full name or a short description of the method (empty by default)