#include <Stat2.hh>
Public Methods | |
| Stat_ () | |
| constructor. | |
| void | clear () |
| clear(): resets the calling object. | |
| Stat_& | operator+= (double Val) |
| Stat+=Val: adds a new data point Val to Stat. Returns calling object. | |
| unsigned int | data_no () const |
| Returns the number of data points seen. | |
| double | min () const |
| min(), max(): return the minimal/maximal value throws Statexc_ if there were no data items. | |
| double | max () const |
| double | avg () const |
| avg(): returns the average. More... | |
| double | sd () const |
| sd(): returns the standard deviation. More... | |
| double | skew () const |
| skew(): returns the estimated skewness. More... | |
| double | kurt () const |
| kurt(): returns the estimated kurtosis. More... | |
Private Attributes | |
| double | Sx |
| double | Sx2 |
| double | Sx3 |
| double | Sx4 |
| sums for moments. | |
| double | Min |
| double | Max |
| minimal and maximal value. | |
| unsigned int | N |
| number of data. | |
Static Private Attributes | |
| const double | BIG_NUMBER |
| for min,max init. | |
| const double | SMALL_NUMBER |
| for near-zero testing. | |
Friends | |
| ostream& | operator<< (ostream &Out, const Stat_ &S) |
| Prints a Stat_ object to Out. More... | |
| istream& | operator>> (istream &In, Stat_ &S) |
| Reads a Stat_ object from In. More... | |
A Stat_ object works much in the same way as the stat operations on a programmable calculator. Double data are accumulated in "stat sums" and the average and SD can be obtained from these.
Definition at line 40 of file Stat2.hh.
|
|
constructor.
|
|
|
clear(): resets the calling object.
|
|
|
Stat+=Val: adds a new data point Val to Stat. Returns calling object.
|
|
|
Returns the number of data points seen.
|
|
|
min(), max(): return the minimal/maximal value throws Statexc_ if there were no data items.
|
|
|
|
|
|
avg(): returns the average. Throws Statexc_ if there were no data items at all. |
|
|
sd(): returns the standard deviation. Throws Statexc_ if there were no data items at all. If N=1, 0.0 is returned automatically. |
|
|
skew(): returns the estimated skewness. Throws Statexc_ if there were no data items at all. If N==1 happens to be 0.0, then 0.0 is returned. Throws Sdevexc_ if the s.d. was not larger than 0.0. |
|
|
kurt(): returns the estimated kurtosis. Note that 3.0 is NOT subtracted from this value (as opposed to the Numerical Recipes convention), so the kurtosis of a Gaussian distribution should be about 3.0. Throws Statexc_ if there were no data items at all. If N==1 happens to be 0.0, then 0.0 is returned. Throws Sdevexc_ if the s.d. was not larger than 0.0. |
|
|
Prints a Stat_ object to Out. The format is:-
8 STAT
N = 1000
MIN = -4.7362
MAX = 6.30655
SUM = 957.413
SUM2 = 4575.58
SUM3 = 11291.8
SUM4 = 57072.3
ENDSTAT
|
|
|
Reads a Stat_ object from In. The format is:-
8 STAT
N = 1000
MIN = -4.7362
MAX = 6.30655
SUM = 957.413
SUM2 = 4575.58
SUM3 = 11291.8
SUM4 = 57072.3
ENDSTAT
|
|
|
for min,max init.
|
|
|
for near-zero testing.
|
|
|
|
|
|
|
|
|
|
|
|
sums for moments.
|
|
|
|
|
|
minimal and maximal value.
|
|
|
number of data.
|
1.2.6 written by Dimitri van Heesch,
© 1997-2001