Class estadistica

java.lang.Object
  |
  +--estadistica

public class estadistica
extends java.lang.Object

This is the main class.

It provides useful methods to calculate the mean value of a serie of numbers, and its standard deviation and more.

Version:
0.1 (12 Abril 2004)
Author:
Luis G. López, Argentina

Constructor Summary
estadistica()
          This constructor sets minimo1 and minimo2 to their defalut values (10 and 30) The meaning of these values are explain latter, in the getErrAbs method.
 
Method Summary
 double getErrAbs(double[] data)
          Calculates the absolute error of a serie of values.
 double getPromedio(double[] data)
          Gets the mean value a serie of values.
 double getSigmaN_1(double[] data)
          Calculates the sigmaN-1 of a serie of values.
 double getSigmaN(double[] data)
          Calculates the sigmaN of a serie of values.
 double sdKnuth(double[] data, int minus)
          Calculates the standard deviation of an array of numbers.
 void setMinimo1(int m)
          Sets the value of minimum1.
 void setMinimo2(int m)
          Sets the value of minimum2.
 void setN(int n)
          Sets the number of measures to be taken into account.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

estadistica

public estadistica()
This constructor sets minimo1 and minimo2 to their defalut values (10 and 30)

The meaning of these values are explain latter, in the getErrAbs method.

Method Detail

setN

public void setN(int n)
Sets the number of measures to be taken into account.

Parameters:
n - number of measures

setMinimo1

public void setMinimo1(int m)
Sets the value of minimum1.

Parameters:
m - the value of minimum1

setMinimo2

public void setMinimo2(int m)
Sets the value of minimum2.

Parameters:
m - the value of minimum2

getPromedio

public double getPromedio(double[] data)
Gets the mean value a serie of values.


getSigmaN

public double getSigmaN(double[] data)
Calculates the sigmaN of a serie of values.


getSigmaN_1

public double getSigmaN_1(double[] data)
Calculates the sigmaN-1 of a serie of values.


getErrAbs

public double getErrAbs(double[] data)
Calculates the absolute error of a serie of values.

If the number of values is equal or less than minimum1, it simply calculates the mean value between the maximum and minimun value of the array

If the number of values is greater than minimum1 and equal or less than minimum2, it divides sigmaN-1 and the square root of the number of values, and multiplies the result by 2. If the number of values is greater than minimum2, it divides sigmaN and the square root of the number of values, and multiplies the result by 2.


sdKnuth

public double sdKnuth(double[] data,
                      int minus)
Calculates the standard deviation of an array of numbers. see Knuth's The Art Of Computer Programming Volume II: Seminumerical Algorithms This algorithm is slower, but more resistant to error propagation.

Parameters:
data - Numbers to compute the standard deviation of. Array must contain two or more numbers.
Returns:
standard deviation estimate of population ( to get estimate of sample, use n instead of n-1 in last line )