FreeHEP API
Version current

hep.aida.ref.dataSet
Class DataStatistics

java.lang.Object
  extended byhep.aida.ref.dataSet.DataStatistics

public class DataStatistics
extends Object

Author:
The FreeHEP team @ SLAC This class is meant to calculate the statistics associated with a n-dimensional data set. In particular it calculates the following quantities for "fillable" data objects like Histograms, Clouds, Profiles, Tuples for each of its coordinates: - mean - rootMeanSquared and the global quantities: - entries - sum of weights - equivalent entries These quantities for a data set {xi} with weights {wi} are defined as: - mean = sum(xi*wi)/sumOfWeights - rootMeanSquared = sqrt( sum(xi*xi*wi)*sum(wi) - sum(xi*wi)*sum(xi*wi) )/sum(wi) - sumOfWeights = sum(wi) - entries = sum(1) - equivalent entries = sum(wi)*sum(wi)/sum(wi*wi) Internally it uses the class MeanAndRmsStatistics to calculate the mean and rms for each of the coordinates.
Source Code:
DataStatistics.java

Constructor Summary
DataStatistics(int dimension)
          Creates a new instance of DataSetStatistics.
DataStatistics(String[] descriptions)
          Creates a new instance of DataSetStatistics.
 
Method Summary
 void addEntries(double[] mean, double[] rms, double sumw, double sumw2, int entries)
          Add a set of weighted entries to this DataSetStatistics.
 void addEntries(double[] mean, double[] rms, int entries)
          Add a set of entries to this DataSetStatistics.
 void addEntry(double[] x)
          Add a new entry to this DataSetStatistics with unit weight.
 void addEntry(double[] x, double w)
          Add a weighted entry to this DataSetStatistics.
 String description(int coord)
          Get the description corresponding to a coordinate.
 int dimension()
          Get the dimension of the DataStatistics.
 int entries()
          Get the number of entries in this data set
 double equivalentEntries()
          Get the equivalent entries for this data set.
 double mean(int coord)
          Get the mean for a given coordinate.
 void removeEntries(double[] mean, double[] rms, double sumw, double sumw2, int entries)
          Remove the information corresponding to a set of weighted entries.
 void removeEntries(double[] mean, double[] rms, int entries)
          Remove the information corresponding to a set of weighted entries.
 void removeEntry(double[] x)
          Remove an entry from this DataSetStatistics with unit weight.
 void removeEntry(double[] x, double w)
          Remove a weighted entry from this DataSetStatistics.
 void reset()
          Reset all the statistics quantities to zero.
 double rms(int coord)
          Get the rms for a given coordinate.
 void scale(double scaleFactor)
          Scale the statistics by a give scaleFactor Rescaling is equivalent to multiplying all the weights by the scale factor.
 void setDescription(int coord, String description)
          Set the description for a given coordinate
 void setDescription(String[] descriptions)
          Set the description for all the coordinates.
 double sumOfWeights()
          Get the sum of weights for this data set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataStatistics

public DataStatistics(String[] descriptions)
Creates a new instance of DataSetStatistics.

Parameters:
descriptions - Is an array specifying the description for each of the coordinates of this data set.

DataStatistics

public DataStatistics(int dimension)
Creates a new instance of DataSetStatistics.

Parameters:
dimension - The dimension, i.e. the number of coordinates of this data set.
Method Detail

dimension

public int dimension()
Get the dimension of the DataStatistics.

Returns:
The dimension of the DataStatistics.

addEntry

public void addEntry(double[] x,
                     double w)
Add a weighted entry to this DataSetStatistics. The statistical information is updated.

Parameters:
x - The coordinates of the added entry.
w - The corresponding weight.

addEntry

public void addEntry(double[] x)
Add a new entry to this DataSetStatistics with unit weight.

Parameters:
x - The coordinates of the added entry.

removeEntry

public void removeEntry(double[] x,
                        double w)
Remove a weighted entry from this DataSetStatistics. The statistical information is updated.

Parameters:
x - The coordinates of the removed entry.
w - The corresponding weight.

removeEntry

public void removeEntry(double[] x)
Remove an entry from this DataSetStatistics with unit weight.

Parameters:
x - The coordinates of the entry to remove.

addEntries

public void addEntries(double[] mean,
                       double[] rms,
                       double sumw,
                       double sumw2,
                       int entries)
Add a set of weighted entries to this DataSetStatistics. The statistical information is updated.

Parameters:
mean - The mean of the entries to be added.
rms - The rms of the entries to be added.
sumw - The sum of weights of the entries to be added.
sumw2 - The sum of weights squared of the entries to be added.
entries - The number of the entries to be added.

addEntries

public void addEntries(double[] mean,
                       double[] rms,
                       int entries)
Add a set of entries to this DataSetStatistics. The statistical information is updated.

Parameters:
mean - The mean of the entries to be added.
rms - The rms of the entries to be added.
entries - The number of the entries to be added.

removeEntries

public void removeEntries(double[] mean,
                          double[] rms,
                          double sumw,
                          double sumw2,
                          int entries)
Remove the information corresponding to a set of weighted entries.

Parameters:
mean - The mean of the entries to be removed.
rms - The rms of the entries to be removed.
sumw - The sum of weights of the entries to be removed.
sumw2 - The sum of weights squared of the entries to be removed.
entries - The number of the entries to be added.

removeEntries

public void removeEntries(double[] mean,
                          double[] rms,
                          int entries)
Remove the information corresponding to a set of weighted entries.

Parameters:
mean - The mean of the entries to be removed.
rms - The rms of the entries to be removed.
entries - The number of the entries to be added.

mean

public double mean(int coord)
Get the mean for a given coordinate.

Parameters:
coord - The index of the coordinate.
Returns:
The mean of the coordinate coord.

rms

public double rms(int coord)
Get the rms for a given coordinate.

Parameters:
coord - The index of the coordinage;
Returns:
The rms of the coordinate coord.

sumOfWeights

public double sumOfWeights()
Get the sum of weights for this data set.

Returns:
The sum of weights.

equivalentEntries

public double equivalentEntries()
Get the equivalent entries for this data set.

Returns:
The equivalent entries for this data set.

entries

public int entries()
Get the number of entries in this data set

Returns:
The number of entries.

scale

public void scale(double scaleFactor)
Scale the statistics by a give scaleFactor Rescaling is equivalent to multiplying all the weights by the scale factor.

Parameters:
scaleFactor - The scaleFactor.

reset

public void reset()
Reset all the statistics quantities to zero.


setDescription

public void setDescription(String[] descriptions)
Set the description for all the coordinates.

Parameters:
descriptions - The array containing the description for each coordinate.

setDescription

public void setDescription(int coord,
                           String description)
Set the description for a given coordinate

Parameters:
coord - The index of the coordinate.
description - The description for the coordinate

description

public String description(int coord)
Get the description corresponding to a coordinate.

Parameters:
coord - The coordinate.
Returns:
The description corresponding to that coordinate.

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.