public class Statistics extends Object implements Cloneable, Serializable
An instance of Statistics
is initially empty (i.e. all statistical values are set to
NaN
). The statistics are updated every time an add(double)
method is
invoked with a non-NaN 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);
Modifier and Type | Class and Description |
---|---|
static class |
Statistics.Delta
Holds some statistics about a series of sample values and the difference between them.
|
Constructor and Description |
---|
Statistics()
Constructs an initially empty set of statistics.
|
Modifier and Type | Method and Description |
---|---|
void |
add(double sample)
Updates statistics for the specified sample.
|
void |
add(long sample)
Updates statistics for the specified sample.
|
void |
add(Statistics stats)
Updates statistics with all samples from the specified
stats . |
Statistics |
clone()
Returns a clone of this statistics.
|
int |
count()
Returns the number of samples, excluding
NaN values. |
int |
countNaN()
Returns the number of
NaN samples. |
boolean |
equals(Object obj)
Tests this statistics with the specified object for equality.
|
int |
hashCode()
Returns a hash code value for this statistics.
|
double |
maximum()
Returns the maximum sample value, or
NaN if none. |
double |
mean()
Returns the mean value, or
NaN if none. |
double |
minimum()
Returns the minimum sample value, or
NaN if none. |
double |
range()
Returns the range of sample values.
|
void |
reset()
Resets the statistics to their initial
NaN values. |
double |
rms()
Returns the root mean square, or
NaN if none. |
double |
standardDeviation(boolean allPopulation)
Retourne l'écart type des échantillons par rapport à la moyenne.
|
String |
toString()
Returns a string representation of this statistics.
|
String |
toString(Locale locale,
boolean tabulations)
Returns a localized string representation of this statistics.
|
public Statistics()
Double.NaN
.public void reset()
NaN
values. This method reset this
object state as if it was just created.public void add(double sample)
add
method is usually invoked
inside a for
loop.sample
- The sample value. NaN
values are ignored.add(long)
,
add(Statistics)
public void add(long sample)
add
method is usually invoked
inside a for
loop.sample
- The sample value.add(double)
,
add(Statistics)
public void add(Statistics stats)
stats
. Invoking this method is
equivalent (except for rounding errors) to invoking add
for all samples
that were added to stats
.stats
- The statistics to be added to this
, or null
if none.public int countNaN()
NaN
samples. NaN
samples are ignored in all
other statitical computation. This method count them for information purpose only.public int count()
NaN
values.public double minimum()
NaN
if none.maximum()
public double maximum()
NaN
if none.minimum()
public double range()
public double mean()
NaN
if none.public double rms()
NaN
if none.public double standardDeviation(boolean allPopulation)
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% |
allPopulation
- La valeur true
indique que les données fournies aux différentes
méthodes add(...)
représentent l'ensemble de la polulation. La valeur false
indique que ces données ne représentent qu'un échantillon de la population, ce qui
est généralement le cas. Si le nombre de données est élevé, alors les valeurs true
et false
donneront sensiblement les mêmes résultats.public Statistics clone()
clone
in class Object
Object.clone()
public boolean equals(Object obj)
public int hashCode()
public final String toString()
toString(Locale, boolean)
using the default locale and spaces separator.public String toString(Locale locale, boolean tabulations)
IfCompte: 8726 Minimum: 6.853 Maximum: 8.259 Moyenne: 7.421 RMS: 7.846 Écart-type: 6.489
tabulations
is true, then labels (e.g. "Minimum") and values (e.g. "6.853") are
separated by tabulations. Otherwise, they are separated by spaces.Copyright © 1996–2019 Geotools. All rights reserved.