Provides simple statistics on a 1D variable and stores the samples. More...
#include <mbl_sample_stats_1d.h>
Public Member Functions | |
mbl_sample_stats_1d () | |
Default ctor. | |
mbl_sample_stats_1d (const vcl_vector< double > &samples) | |
ctor with a vcl_vector of samples | |
mbl_sample_stats_1d (const vnl_vector< double > &samples) | |
ctor with a vnl_vector of samples | |
~mbl_sample_stats_1d () | |
void | set_use_mvue (bool b) |
Sets type of variance normalisation. | |
void | clear () |
Remove all data. | |
void | add_sample (double v) |
Add given observation. | |
unsigned | n_samples () const |
Number of samples. | |
const vcl_vector< double > & | samples () const |
vector of samples | |
double | mean () const |
Mean of current samples. | |
double | mean_of_absolutes () const |
Mean of absolutes current samples. | |
double | median () const |
Median of current samples. | |
double | nth_percentile (int n) const |
The last value within the n_th percentile of the distribution. | |
double | quantile (double q) const |
Calculate a value at a specified quantile q. | |
double | sd () const |
Standard deviation of current samples. | |
double | stdError () const |
Standard error (i.e. sd of estimate of the mean). | |
double | variance () const |
Variance of current samples. | |
double | skewness () const |
Returns the skewness of the samples. | |
double | kurtosis () const |
Returns the kurtosis of the samples. | |
double | min () const |
Min of current samples. | |
double | max () const |
Max of current samples. | |
double | sum () const |
Sum of current samples. | |
double | sum_squares () const |
Sum of squares of current samples. | |
double | rms () const |
root mean square of current samples. | |
mbl_sample_stats_1d & | operator+= (const mbl_sample_stats_1d &s1) |
Add statistics together. | |
void | print_summary (vcl_ostream &os) const |
Print summary of data. | |
void | print_all (vcl_ostream &os, const vcl_string &delim="\n") const |
Print all data. | |
short | version_no () const |
Version number for I/O. | |
void | b_write (vsl_b_ostream &bfs) const |
void | b_read (vsl_b_istream &bfs) |
bool | operator== (const mbl_sample_stats_1d &s) const |
Test for equality. | |
Private Attributes | |
vcl_vector< double > | samples_ |
mbl_stats_1d | stats_1d_ |
bool | use_mvue_ |
Friends | |
mbl_sample_stats_1d | operator+ (const mbl_sample_stats_1d &s1, const mbl_sample_stats_1d &s2) |
Provides simple statistics on a 1D variable and stores the samples.
Definition at line 16 of file mbl_sample_stats_1d.h.
mbl_sample_stats_1d::mbl_sample_stats_1d | ( | ) |
Default ctor.
Definition at line 34 of file mbl_sample_stats_1d.cxx.
mbl_sample_stats_1d::mbl_sample_stats_1d | ( | const vcl_vector< double > & | samples | ) |
ctor with a vcl_vector of samples
Definition at line 12 of file mbl_sample_stats_1d.cxx.
mbl_sample_stats_1d::mbl_sample_stats_1d | ( | const vnl_vector< double > & | samples | ) |
ctor with a vnl_vector of samples
Definition at line 23 of file mbl_sample_stats_1d.cxx.
mbl_sample_stats_1d::~mbl_sample_stats_1d | ( | ) |
Definition at line 41 of file mbl_sample_stats_1d.cxx.
void mbl_sample_stats_1d::add_sample | ( | double | v | ) |
Add given observation.
Definition at line 56 of file mbl_sample_stats_1d.cxx.
void mbl_sample_stats_1d::b_read | ( | vsl_b_istream & | bfs | ) |
Definition at line 371 of file mbl_sample_stats_1d.cxx.
void mbl_sample_stats_1d::b_write | ( | vsl_b_ostream & | bfs | ) | const |
Definition at line 361 of file mbl_sample_stats_1d.cxx.
void mbl_sample_stats_1d::clear | ( | ) |
Remove all data.
Definition at line 47 of file mbl_sample_stats_1d.cxx.
double mbl_sample_stats_1d::kurtosis | ( | ) | const |
Returns the kurtosis of the samples.
Definition at line 267 of file mbl_sample_stats_1d.cxx.
double mbl_sample_stats_1d::max | ( | ) | const |
Max of current samples.
Take care. if there are no samples, this method returns -ve maximum double Always check number of samples first
Definition at line 304 of file mbl_sample_stats_1d.cxx.
double mbl_sample_stats_1d::mean | ( | ) | const |
Mean of current samples.
Definition at line 72 of file mbl_sample_stats_1d.cxx.
double mbl_sample_stats_1d::mean_of_absolutes | ( | ) | const |
Mean of absolutes current samples.
Definition at line 79 of file mbl_sample_stats_1d.cxx.
double mbl_sample_stats_1d::median | ( | ) | const |
Median of current samples.
Take care. if there are no samples, this method returns maximum double (a very large number) Always check number of samples first
Definition at line 89 of file mbl_sample_stats_1d.cxx.
double mbl_sample_stats_1d::min | ( | ) | const |
Min of current samples.
Take care. if there are no samples, this method returns maximum double Always check number of samples first
Definition at line 296 of file mbl_sample_stats_1d.cxx.
unsigned mbl_sample_stats_1d::n_samples | ( | ) | const |
Number of samples.
Definition at line 65 of file mbl_sample_stats_1d.cxx.
double mbl_sample_stats_1d::nth_percentile | ( | int | n | ) | const |
The last value within the n_th percentile of the distribution.
Definition at line 172 of file mbl_sample_stats_1d.cxx.
mbl_sample_stats_1d & mbl_sample_stats_1d::operator+= | ( | const mbl_sample_stats_1d & | s1 | ) |
Add statistics together.
Definition at line 334 of file mbl_sample_stats_1d.cxx.
bool mbl_sample_stats_1d::operator== | ( | const mbl_sample_stats_1d & | s | ) | const |
Test for equality.
Definition at line 348 of file mbl_sample_stats_1d.cxx.
void mbl_sample_stats_1d::print_all | ( | vcl_ostream & | os, |
const vcl_string & | delim = "\n" |
||
) | const |
Print all data.
delim | Separate each value with this character/string. |
Definition at line 414 of file mbl_sample_stats_1d.cxx.
void mbl_sample_stats_1d::print_summary | ( | vcl_ostream & | os | ) | const |
Print summary of data.
Definition at line 395 of file mbl_sample_stats_1d.cxx.
double mbl_sample_stats_1d::quantile | ( | double | q | ) | const |
Calculate a value at a specified quantile q.
q | Required quantile 0.0 <= q <= 1.0 |
Definition at line 132 of file mbl_sample_stats_1d.cxx.
double mbl_sample_stats_1d::rms | ( | ) | const |
root mean square of current samples.
Definition at line 326 of file mbl_sample_stats_1d.cxx.
const vcl_vector<double>& mbl_sample_stats_1d::samples | ( | ) | const [inline] |
vector of samples
Definition at line 50 of file mbl_sample_stats_1d.h.
double mbl_sample_stats_1d::sd | ( | ) | const |
Standard deviation of current samples.
Definition at line 214 of file mbl_sample_stats_1d.cxx.
void mbl_sample_stats_1d::set_use_mvue | ( | bool | b | ) | [inline] |
Sets type of variance normalisation.
mvue | if true (the default) the variance uses the "minimum variance unbiased estimator" which normalises by n_samples()-1 else will normalise the variance by n_samples() |
Definition at line 38 of file mbl_sample_stats_1d.h.
double mbl_sample_stats_1d::skewness | ( | ) | const |
Returns the skewness of the samples.
Definition at line 238 of file mbl_sample_stats_1d.cxx.
double mbl_sample_stats_1d::stdError | ( | ) | const |
Standard error (i.e. sd of estimate of the mean).
Definition at line 221 of file mbl_sample_stats_1d.cxx.
double mbl_sample_stats_1d::sum | ( | ) | const |
Sum of current samples.
Definition at line 312 of file mbl_sample_stats_1d.cxx.
double mbl_sample_stats_1d::sum_squares | ( | ) | const |
Sum of squares of current samples.
Definition at line 319 of file mbl_sample_stats_1d.cxx.
double mbl_sample_stats_1d::variance | ( | ) | const |
Variance of current samples.
Definition at line 189 of file mbl_sample_stats_1d.cxx.
short mbl_sample_stats_1d::version_no | ( | ) | const |
Version number for I/O.
Definition at line 354 of file mbl_sample_stats_1d.cxx.
mbl_sample_stats_1d operator+ | ( | const mbl_sample_stats_1d & | s1, |
const mbl_sample_stats_1d & | s2 | ||
) | [friend] |
Definition at line 450 of file mbl_sample_stats_1d.cxx.
vcl_vector<double> mbl_sample_stats_1d::samples_ [private] |
Definition at line 18 of file mbl_sample_stats_1d.h.
mbl_stats_1d mbl_sample_stats_1d::stats_1d_ [private] |
Definition at line 19 of file mbl_sample_stats_1d.h.
bool mbl_sample_stats_1d::use_mvue_ [private] |
Definition at line 20 of file mbl_sample_stats_1d.h.