de.unidu.is.statistics
Class Moments

java.lang.Object
  extended byde.unidu.is.statistics.Moments

public class Moments
extends java.lang.Object

A class for encapsulating and computing statistical moments (expectation, variance/standard deviation).

Since:
2003-09-23
Version:
$Revision: 1.8 $, $Date: 2005/03/19 16:16:30 $
Author:
Henrik Nottelmann

Constructor Summary
Moments()
          Creates a new, empty instance.
Moments(double exp, double var)
          Creates a new instance and sets the moments directly.
Moments(java.util.List values)
          Creates a new instance and computes the moments from the sample values.
 
Method Summary
 double get(int index)
          Returns the sample value at the specified index.
 double getExpectation()
          Returns the expectation.
 double[] getMoments()
          Returns an array with the moments.
 double getStandardDeviation()
          Returns the standard deviation.
 java.util.List getValues()
          Returns the sample values.
 double getVariance()
          Returns the variance.
 void setExpectation(double expectation)
          Sets the expectation.
 void setValues(java.util.List values)
          Sets the sample values.
 void setVariance(double variance)
          Sets the variance.
 int size()
          Returns the number of sample values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Moments

public Moments()
Creates a new, empty instance.


Moments

public Moments(double exp,
               double var)
Creates a new instance and sets the moments directly.

Parameters:
exp - expectation
var - variance

Moments

public Moments(java.util.List values)
Creates a new instance and computes the moments from the sample values.

Parameters:
values - sample values
Method Detail

getStandardDeviation

public double getStandardDeviation()
Returns the standard deviation.

Returns:
standard deviation

getMoments

public double[] getMoments()
Returns an array with the moments.

Returns:
array with the moments (0: expectation, 1: variance)

size

public int size()
Returns the number of sample values.

Returns:
number of sample values

get

public double get(int index)
Returns the sample value at the specified index.

Parameters:
index - index
Returns:
sample value at the specified index

getExpectation

public double getExpectation()
Returns the expectation.

Returns:
expectation.

setExpectation

public void setExpectation(double expectation)
Sets the expectation.

Parameters:
expectation - expectation to set.

getValues

public java.util.List getValues()
Returns the sample values.

Returns:
values.

setValues

public void setValues(java.util.List values)
Sets the sample values.

Parameters:
values - values to set.

getVariance

public double getVariance()
Returns the variance.

Returns:
variance.

setVariance

public void setVariance(double variance)
Sets the variance.

Parameters:
variance - variance to set.