Package oms3.util

Class Stats


  • public class Stats
    extends Object
    Author:
    Olaf David
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double bias​(double[] pred, double[] valid)  
      static double err_sum​(double[] validation, double[] prediction)  
      static double gradient​(double[] xData, double[] yData)  
      static double intercept​(double[] xData, double[] yData)  
      static double ioa​(double[] prediction, double[] validation, double pow)
      Calculates the index of agreement (ioa) between a test data set and a verification data set after Willmot & Wicks (1980).
      static double lag1​(double[] vals)
      Returns the lag-1 autocorrelation of a dataset;
      static int length​(double[] vals)  
      static double max​(double[] vals)  
      static double mean​(double[] vals)  
      static double meandev​(double[] vals)  
      static double median​(double[] vals)  
      static double min​(double[] vals)  
      static double nashsut​(double[] prediction, double[] validation, double pow)
      Calculates the efficiency between a test data set and a verification data set after Nash & Sutcliffe (1970).
      static double nashsut_log​(double[] prediction, double[] validation, double pow)
      Calculates the efficiency between the log values of a test data set and a verification data set after Nash & Sutcliffe (1970).
      static double norm_vec​(double x, double y, double z)
      Normalized Vector.
      static double product​(double[] vals)  
      static double quantile​(double[] vals, double phi)  
      static double r2​(double[] xData, double[] yData)  
      static double random​(double min, double max)
      Generate a random number in a range.
      static double range​(double[] vals)  
      static double rmse​(double[] pred, double[] valid)  
      static double round​(double val, int places)
      Round a double value to a specified number of decimal places.
      static float round​(float val, int places)
      Round a float value to a specified number of decimal places.
      static double stddev​(double[] vals)  
      static double stderr​(double[] vals)  
      static double sum​(double[] vals)  
      static double variance​(double[] vals)  
    • Method Detail

      • norm_vec

        public static double norm_vec​(double x,
                                      double y,
                                      double z)
        Normalized Vector.
      • max

        public static double max​(double[] vals)
      • min

        public static double min​(double[] vals)
      • range

        public static double range​(double[] vals)
      • length

        public static int length​(double[] vals)
      • median

        public static double median​(double[] vals)
      • mean

        public static double mean​(double[] vals)
      • stddev

        public static double stddev​(double[] vals)
      • stderr

        public static double stderr​(double[] vals)
      • variance

        public static double variance​(double[] vals)
      • meandev

        public static double meandev​(double[] vals)
      • sum

        public static double sum​(double[] vals)
      • product

        public static double product​(double[] vals)
      • quantile

        public static double quantile​(double[] vals,
                                      double phi)
      • lag1

        public static double lag1​(double[] vals)
        Returns the lag-1 autocorrelation of a dataset;
      • rmse

        public static double rmse​(double[] pred,
                                  double[] valid)
      • bias

        public static double bias​(double[] pred,
                                  double[] valid)
      • nashsut

        public static double nashsut​(double[] prediction,
                                     double[] validation,
                                     double pow)
        Calculates the efficiency between a test data set and a verification data set after Nash & Sutcliffe (1970). The efficiency is described as the proportion of the cumulated cubic deviation between both data sets and the cumulated cubic deviation between the verification data set and its mean value.
        Parameters:
        prediction - the simulation data set
        validation - the validation (observed) data set
        pow - the power for the deviation terms
        Returns:
        the calculated efficiency or -9999 if an error occurs
      • nashsut_log

        public static double nashsut_log​(double[] prediction,
                                         double[] validation,
                                         double pow)
        Calculates the efficiency between the log values of a test data set and a verification data set after Nash & Sutcliffe (1970). The efficiency is described as the proportion of the cumulated cubic deviation between both data sets and the cumulated cubic deviation between the verification data set and its mean value.
        Parameters:
        prediction - the simulation data set
        validation - the validation (observed) data set
        pow - the power for the deviation terms
        Returns:
        the calculated log_efficiency or -9999 if an error occurs
      • err_sum

        public static double err_sum​(double[] validation,
                                     double[] prediction)
      • ioa

        public static double ioa​(double[] prediction,
                                 double[] validation,
                                 double pow)
        Calculates the index of agreement (ioa) between a test data set and a verification data set after Willmot & Wicks (1980). The ioa is described as the proportion of the cumulated cubic deviation between both data sets and the squared sum of the absolute deviations between the verification data set and the test mean value and the test data set and its mean value.
        Parameters:
        prediction - the test Data set
        validation - the verification data set
        pow - the power
        Returns:
        the calculated ioa or -9999 if an error occurs
      • intercept

        public static double intercept​(double[] xData,
                                       double[] yData)
      • gradient

        public static double gradient​(double[] xData,
                                      double[] yData)
      • r2

        public static double r2​(double[] xData,
                                double[] yData)
      • round

        public static double round​(double val,
                                   int places)
        Round a double value to a specified number of decimal places.
        Parameters:
        val - the value to be rounded.
        places - the number of decimal places to round to.
        Returns:
        val rounded to places decimal places.
      • round

        public static float round​(float val,
                                  int places)
        Round a float value to a specified number of decimal places.
        Parameters:
        val - the value to be rounded.
        places - the number of decimal places to round to.
        Returns:
        val rounded to places decimal places.
      • random

        public static double random​(double min,
                                    double max)
        Generate a random number in a range.
        Parameters:
        min -
        max -
        Returns:
        the random value in the min/max range