| java.lang.Object org.geotools.math.Statistics
Statistics | public class Statistics implements Cloneable,Serializable(Code) | | Hold some statistics about a series of sample values. Given a series of sample values
s0, s1, s2,
s3..., this class computes
,
,
,
and
. Statistics are computed on the fly;
the sample values are never stored in memory.
An instance of
Statistics is initially empty (i.e. all statistical values are set
to
Double.NaN NaN ). The statistics are updated every time an
Statistics.add(double) method is invoked with a non-
value. A typical usage of this
class is:
double[] data = new double[1000];
// (Compute some data values here...)
Statistics stats = new Statistics();
for (int i=0; i<data.length; i++) {
stats.add(data[i]);
}
System.out.println(stats);
version: $Id: Statistics.java 22443 2006-10-27 20:47:22Z desruisseaux $ author: Martin Desruisseaux since: 2.0 |
Inner Class :public static class Delta extends Statistics | |
Constructor Summary | |
public | Statistics() Construct an initially empty set of statistics. |
Method Summary | |
public void | add(double sample) Update statistics for the specified sample. | public void | add(long sample) Update statistics for the specified sample. | public void | add(Statistics stats) Update statistics with all samples from the specified
stats . | public Object | clone() Returns a clone of this statistics. | public int | count() Returns the number of samples, excluding
Double.NaN NaN values. | public int | countNaN() Returns the number of
Double.NaN NaN samples. | public boolean | equals(Object obj) Test this statistics with the specified object for equality. | public int | hashCode() Returns a hash code value for this statistics. | public double | maximum() Returns the maximum sample value, or
Double.NaN NaN if none. | public double | mean() Returns the mean value, or
Double.NaN NaN if none. | public double | minimum() Returns the minimum sample value, or
Double.NaN NaN if none. | public double | range() Returns the range of sample values. | public void | reset() Reset the statistics to their initial
Double.NaN NaN values. | public double | rms() Returns the root mean square, or
Double.NaN NaN if none. | public double | standardDeviation(boolean allPopulation) Retourne l'écart type des échantillons par rapport à la moyenne. | final public String | toString() Returns a string representation of this statistics. | public String | toString(Locale locale, boolean tabulations) Returns a localized string representation of this statistics. |
Statistics | public Statistics()(Code) | | Construct an initially empty set of statistics.
All statistical values are initialized to
Double.NaN .
|
add | public void add(Statistics stats)(Code) | | Update statistics with all samples from the specified
stats . Invoking this
method is equivalent (except for rounding errors) to invoking
Statistics.add(double) add for all samples that were added to
stats .
Parameters: stats - The statistics to be added to this , or null if none. |
clone | public Object clone()(Code) | | Returns a clone of this statistics.
|
count | public int count()(Code) | | Returns the number of samples, excluding
Double.NaN NaN values.
|
countNaN | public int countNaN()(Code) | | Returns the number of
Double.NaN NaN samples.
NaN samples are
ignored in all other statitical computation. This method count them for information
purpose only.
|
equals | public boolean equals(Object obj)(Code) | | Test this statistics with the specified object for equality.
|
hashCode | public int hashCode()(Code) | | Returns a hash code value for this statistics.
|
mean | public double mean()(Code) | | Returns the mean value, or
Double.NaN NaN if none.
|
reset | public void reset()(Code) | | Reset the statistics to their initial
Double.NaN NaN values.
This method reset this object state as if it was just created.
|
rms | public double rms()(Code) | | Returns the root mean square, or
Double.NaN NaN if none.
|
standardDeviation | public double standardDeviation(boolean allPopulation)(Code) | | Retourne l'écart type des échantillons par rapport à la moyenne. Si les données
fournies aux différentes méthodes
add(...) se distribuent selon une
loi normale, alors l'écart type est la distance de part et d'autre de la moyenne
dans lequel se trouveraient environ 84% des données. Le tableau ci-dessous donne
le pourcentage approximatif des données que l'on trouve de part et d'autre de la
moyenne à des distances telles que 2 ou 3 fois l'écart-type.
0.5 | 69.1% |
1.0 | 84.2% |
1.5 | 93.3% |
2.0 | 97.7% |
3.0 | 99.9% |
Parameters: allPopulation - La valeur true indique que les données fourniesaux différentes méthodes add(...) représentent l'ensemble dela polulation. La valeur false indique que ces données nereprésentent qu'un échantillon de la population, ce qui est généralement lecas. Si le nombre de données est élevé, alors les valeurs true et false donneront sensiblement les mêmes résultats. |
toString | public String toString(Locale locale, boolean tabulations)(Code) | | Returns a localized string representation of this statistics. This string
will span multiple lines, one for each statistical value. For example:
Compte: 8726
Minimum: 6.853
Maximum: 8.259
Moyenne: 7.421
RMS: 7.846
Écart-type: 6.489
If
tabulations is true, then labels (e.g. "Minimum") and values
(e.g. "6.853") are separated by tabulations. Otherwise, they are separated
by spaces.
|
|
|