vec_math
Class WeightedStatistic

java.lang.Object
  extended by vec_math.WeightedStatistic
Direct Known Subclasses:
ClassicStatistic

public abstract class WeightedStatistic
extends Object

Abstract base class for statistic purpose. Defines routines getAverage() to derive an average value (e.g. arithmetic average). Method getDeviation to return something like a standard deviation. getSkew() and getKurt() for higher order moments. If either the class's constructor or its setValue method is called with null as the deviation array, the boolean Weighed is set to false and an array holding 1.'s the same length as x is generated. The methods getDeviationOfAverage returns the deviation of the average (Deviation is the deviation of the individul measurements. Due to the limited number of points in the sample two more routines are provided: getTrueAverage and getTrueDeviation. Both return the same value as the getAverage and getDeviation methods in the limiting case N->inf. While the true average is normally not known, the true deviation can sometimes be estimated. In any case it must be HIGHER than the apparent Deviation returned by getDeviation. Methods for adding and removing points are included. N holds the actual number of points (public). Comstructs either empty or with array of values.


Field Summary
protected  double Average
           
protected  double Deviation
           
protected  double DeviationOfAverage
           
protected  double Kurt
           
 int N
           
 double[] sigma
           
protected  double Skew
           
private static double SMALL
           
protected  double TrueAverage
           
protected  double TrueDeviation
           
protected  boolean ValidAverage
           
protected  boolean ValidDeviation
           
protected  boolean ValidDeviationOfAverage
           
protected  boolean ValidKurt
           
protected  boolean ValidSkew
           
protected  boolean ValidTrueAverage
           
protected  boolean ValidTrueDeviation
           
protected  boolean Weighed
           
 double[] x
           
protected  double XMax
           
protected  double XMin
           
 boolean xValid
           
 
Constructor Summary
WeightedStatistic()
           
WeightedStatistic(double[] val, double[] sig)
           
 
Method Summary
 void addValue(double xadd)
           
 void addValue(double xadd, double sigadd)
           
 void clear()
           
 boolean deleteValue(double xdel)
           
 boolean deleteValue(double xdel, double sigdel)
           
 boolean deleteValue(int index)
           
abstract  double getAverage()
           
abstract  double getDeviation()
           
abstract  double getDeviationOfAverage()
           
abstract  double getKurt()
           
 double getMax()
           
 double getMin()
           
abstract  double getSkew()
           
 double getSpan()
           
abstract  double getTrueAverage()
           
abstract  double getTrueDeviation()
           
private  void setMinMax()
           
 void setValue(double[] val, double[] sig)
           
abstract  void updateOnAdd(double xadd, double sadd)
           
abstract  void updateOnDelete(double xdel, double sdel)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SMALL

private static final double SMALL
See Also:
Constant Field Values

N

public int N

x

public double[] x

sigma

public double[] sigma

xValid

public boolean xValid

XMax

protected double XMax

XMin

protected double XMin

Weighed

protected boolean Weighed

Average

protected double Average

ValidAverage

protected boolean ValidAverage

TrueAverage

protected double TrueAverage

ValidTrueAverage

protected boolean ValidTrueAverage

DeviationOfAverage

protected double DeviationOfAverage

ValidDeviationOfAverage

protected boolean ValidDeviationOfAverage

Deviation

protected double Deviation

ValidDeviation

protected boolean ValidDeviation

TrueDeviation

protected double TrueDeviation

ValidTrueDeviation

protected boolean ValidTrueDeviation

Skew

protected double Skew

ValidSkew

protected boolean ValidSkew

Kurt

protected double Kurt

ValidKurt

protected boolean ValidKurt
Constructor Detail

WeightedStatistic

public WeightedStatistic()

WeightedStatistic

public WeightedStatistic(double[] val,
                         double[] sig)
Parameters:
val -
sig -
Method Detail

clear

public void clear()

setValue

public void setValue(double[] val,
                     double[] sig)
Parameters:
val -
sig -

addValue

public void addValue(double xadd)
Parameters:
xadd -

addValue

public void addValue(double xadd,
                     double sigadd)
Parameters:
xadd -
sigadd -

deleteValue

public boolean deleteValue(double xdel)
Parameters:
xdel -
Returns:
boolean

deleteValue

public boolean deleteValue(double xdel,
                           double sigdel)
Parameters:
xdel -
sigdel -
Returns:
boolean

deleteValue

public boolean deleteValue(int index)
Parameters:
index -
Returns:
boolean

getMin

public double getMin()
Returns:
double

getMax

public double getMax()

setMinMax

private void setMinMax()

getSpan

public double getSpan()
Returns:
double

getAverage

public abstract double getAverage()
Returns:
double

getTrueAverage

public abstract double getTrueAverage()
Returns:
double

getDeviationOfAverage

public abstract double getDeviationOfAverage()
Returns:
double

getDeviation

public abstract double getDeviation()
Returns:
double

getTrueDeviation

public abstract double getTrueDeviation()
Returns:
double

getSkew

public abstract double getSkew()
Returns:
double

getKurt

public abstract double getKurt()
Returns:
double

updateOnDelete

public abstract void updateOnDelete(double xdel,
                                    double sdel)
Parameters:
xdel -
sdel -

updateOnAdd

public abstract void updateOnAdd(double xadd,
                                 double sadd)
Parameters:
xadd -
sadd -