com.mytrendtimer.trendtimer
Class Statistic

java.lang.Object
  extended by com.mytrendtimer.trendtimer.Statistic

public class Statistic
extends java.lang.Object

Some static methods to calculate various statistical indicators on a float array.

Version:
v0.99.83
Author:
FRM

Constructor Summary
Statistic()
           
 
Method Summary
static float calcArithMean(float[] data, MyTrendTimer mttObjArg)
          Calculates the arithmetic mean of an array of numbers.
static float calcFirst(float[] data, MyTrendTimer mttObjArg)
          Return the first number of the array of numbers.
static float calcLast(float[] data, MyTrendTimer mttObjArg)
          Return the last number of the array of numbers.
static float calcMax(float[] data, MyTrendTimer mttObjArg)
          Calculates the maximum an array of numbers.
static float calcMaxGain(float[] data, MyTrendTimer mttObjArg)
          Calculates the max gain an array of numbers.
static float calcMaxLoose(float[] data, MyTrendTimer mttObjArg)
          Calculates the max loose an array of numbers.
static float calcMedian(float[] data, MyTrendTimer mttObjArg)
          Calculates the pseudo median an array of numbers.
static float calcMin(float[] data, MyTrendTimer mttObjArg)
          Calculates the minimum an array of numbers.
static float calcSimplePerf(float[] data, MyTrendTimer mttObjArg)
          Calculates the performance between first and last in an array of numbers.
static double calcStandardDev(float[] data, MyTrendTimer mttObjArg)
          Calculates standard deviation of an array of numbers.
static float calcVariance(float[] data, MyTrendTimer mttObjArg)
          Calculates variance of an array of numbers.
static float countNbrRecords(float[] data, MyTrendTimer mttObjArg)
          Return the count of numbers of the array of numbers.
static void main(java.lang.String[] args)
          Dummy main method to test the Statistic class
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Statistic

public Statistic()
Method Detail

calcArithMean

public static float calcArithMean(float[] data,
                                  MyTrendTimer mttObjArg)
                           throws java.lang.Exception
Calculates the arithmetic mean of an array of numbers.

Parameters:
data - Numbers to compute the arithmetic mean of. Array must contain two or more numbers.
mttObjArg - The MyTrendTimer controller object to keep the warnings raised.
Returns:
arithmetic mean of population
Throws:
java.lang.Exception

calcFirst

public static float calcFirst(float[] data,
                              MyTrendTimer mttObjArg)
                       throws java.lang.Exception
Return the first number of the array of numbers.

Parameters:
data - Numbers to find the first one. Array must contain two or more numbers.
mttObjArg - The MyTrendTimer controller object to keep the warnings raised.
Returns:
the first number in the array.
Throws:
java.lang.Exception

calcLast

public static float calcLast(float[] data,
                             MyTrendTimer mttObjArg)
                      throws java.lang.Exception
Return the last number of the array of numbers.

Parameters:
data - Numbers to find the last one. Array must contain two or more numbers.
mttObjArg - The MyTrendTimer controller object to keep the warnings raised.
Returns:
the last number in the array.
Throws:
java.lang.Exception

calcMax

public static float calcMax(float[] data,
                            MyTrendTimer mttObjArg)
                     throws java.lang.Exception
Calculates the maximum an array of numbers.

Parameters:
data - Numbers to compute the max of. Array must contain two or more numbers.
mttObjArg - The MyTrendTimer controller object to keep the warnings raised.
Returns:
max of population
Throws:
java.lang.Exception

calcMaxGain

public static float calcMaxGain(float[] data,
                                MyTrendTimer mttObjArg)
                         throws java.lang.Exception
Calculates the max gain an array of numbers.

Parameters:
data - Numbers to compute the max gain of. Array must contain two or more numbers.
mttObjArg - The MyTrendTimer controller object to keep the warnings raised.
Returns:
max gain of population
Throws:
java.lang.Exception

calcMaxLoose

public static float calcMaxLoose(float[] data,
                                 MyTrendTimer mttObjArg)
                          throws java.lang.Exception
Calculates the max loose an array of numbers.

Parameters:
data - Numbers to compute the max loose of. Array must contain two or more numbers.
mttObjArg - The MyTrendTimer controller object to keep the warnings raised.
Returns:
max loose of population
Throws:
java.lang.Exception

calcMedian

public static float calcMedian(float[] data,
                               MyTrendTimer mttObjArg)
                        throws java.lang.Exception
Calculates the pseudo median an array of numbers.

Parameters:
data - Numbers to compute the median of. Array must contain two or more numbers.
mttObjArg - The MyTrendTimer controller object to keep the warnings raised.
Returns:
median of population
Throws:
java.lang.Exception

calcMin

public static float calcMin(float[] data,
                            MyTrendTimer mttObjArg)
                     throws java.lang.Exception
Calculates the minimum an array of numbers.

Parameters:
data - Numbers to compute the min of. Array must contain two or more numbers.
mttObjArg - The MyTrendTimer controller object to keep the warnings raised.
Returns:
min of population
Throws:
java.lang.Exception

calcSimplePerf

public static float calcSimplePerf(float[] data,
                                   MyTrendTimer mttObjArg)
                            throws java.lang.Exception
Calculates the performance between first and last in an array of numbers.

Parameters:
data - Numbers to compute performance of. Array must contain two or more numbers.
mttObjArg - The MyTrendTimer controller object to keep the warnings raised.
Returns:
the performance between first and last.
Throws:
java.lang.Exception

calcStandardDev

public static double calcStandardDev(float[] data,
                                     MyTrendTimer mttObjArg)
                              throws java.lang.Exception
Calculates standard deviation of an array of numbers.

Parameters:
data - Numbers to compute the standard deviation of. Array must contain two or more numbers.
mttObjArg - The MyTrendTimer controller object to keep the warnings raised.
Returns:
standard deviation estimate of population
Throws:
java.lang.Exception

calcVariance

public static float calcVariance(float[] data,
                                 MyTrendTimer mttObjArg)
                          throws java.lang.Exception
Calculates variance of an array of numbers.

Parameters:
data - Numbers to compute the variance of. Array must contain two or more numbers.
mttObjArg - The MyTrendTimer controller object to keep the warnings raised.
Returns:
variance estimate of population (to get estimate of sample, use n instead of n-1 in last line )
Throws:
java.lang.Exception

countNbrRecords

public static float countNbrRecords(float[] data,
                                    MyTrendTimer mttObjArg)
                             throws java.lang.Exception
Return the count of numbers of the array of numbers.

Parameters:
data - Numbers to count. Array must contain two or more numbers.
mttObjArg - The MyTrendTimer controller object to keep the warnings raised.
Returns:
the count (length) of numbers in the array.
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Dummy main method to test the Statistic class

Parameters:
args - not used
Throws:
java.lang.Exception