Public Member Functions | Protected Attributes | List of all members
gnsstk::TwoSampleStats< T > Class Template Reference

Detailed Description

template<class T>
class gnsstk::TwoSampleStats< T >

Conventional statistics for two samples. Also uses a pair of Stats<T> for the each of the two samples.

Definition at line 126 of file Stats.hpp.

#include <Stats.hpp>

Public Member Functions

void Add (const std::vector< T > &X, const std::vector< T > &Y)
 Add two std::vectors of data to the statistics. More...
 
void Add (const T &x, const T &y)
 
void Add (const Vector< T > &X, const Vector< T > &Y)
 Add two gnsstk::Vector<T>s of data to the statistics. More...
 
std::string asShortString (std::string msg=std::string(), int w=0, int p=3) const
 Write TwoSampleStats as a short 1-line string. More...
 
std::string asString (std::string msg=std::string(), int w=7, int p=4) const
 Write TwoSampleStats to a three-line string. More...
 
AverageX (void) const
 return computed X average More...
 
AverageY (void) const
 return computed Y average More...
 
Correlation (void) const
 return correlation More...
 
void Dump (std::vector< unsigned int > &vuint, std::vector< T > &vT)
 
Evaluate (T x) const
 return the predicted Y at the given X, using Slope and Intercept More...
 
Intercept (void) const
 return intercept of best-fit line Y=slope*X + intercept More...
 
void Load (std::vector< unsigned int > &vuint, std::vector< T > &vT)
 
MaximumX (void) const
 return maximum X value More...
 
MaximumY (void) const
 return maximum Y value More...
 
MinimumX (void) const
 return minimum X value More...
 
MinimumY (void) const
 return minimum Y value More...
 
unsigned int N (void) const
 
TwoSampleStats< T > & operator+= (TwoSampleStats< T > &TSS)
 
TwoSampleStats< T > & operator-= (TwoSampleStats< T > &TSS)
 
void Reset (void)
 reset, i.e. ignore earlier data and restart sampling More...
 
SigmaSlope (void) const
 return uncertainty in slope More...
 
SigmaYX (void) const
 return conditional uncertainty = uncertainty y given x More...
 
Slope (void) const
 return slope of best-fit line Y=slope*X + intercept More...
 
StdDevX (void) const
 return computed X standard deviation More...
 
StdDevY (void) const
 return computed Y standard deviation More...
 
void Subtract (const std::vector< T > &X, const std::vector< T > &Y)
 Subtract two std::vectors of data from the statistics. More...
 
void Subtract (const T &x, const T &y)
 
void Subtract (const Vector< T > &X, const Vector< T > &Y)
 Subtract two gnsstk::Vector<T>s of data from the statistics. More...
 
 TwoSampleStats ()
 constructor More...
 
 TwoSampleStats (Vector< T > &X, Vector< T > &Y)
 constructor given two gnsstk::Vector<T>s of data - must be parallel More...
 
VarianceX (void) const
 return computed X variance More...
 
VarianceY (void) const
 return computed Y variance More...
 
VarianceYX (void) const
 return conditional variance = (uncertainty y given x)^2 More...
 

Protected Attributes

unsigned int n
 number of samples added to the statistics More...
 
sumxy
 sum of x*y More...
 
Stats< T > SX
 conventional 1-sample stats for first sample x More...
 
Stats< T > SY
 conventional 1-sample stats for second sample y More...
 

Constructor & Destructor Documentation

◆ TwoSampleStats() [1/2]

template<class T >
gnsstk::TwoSampleStats< T >::TwoSampleStats ( )
inline

constructor

Definition at line 853 of file Stats.hpp.

◆ TwoSampleStats() [2/2]

template<class T >
gnsstk::TwoSampleStats< T >::TwoSampleStats ( Vector< T > &  X,
Vector< T > &  Y 
)
inline

constructor given two gnsstk::Vector<T>s of data - must be parallel

Definition at line 859 of file Stats.hpp.

Member Function Documentation

◆ Add() [1/3]

template<class T >
void gnsstk::TwoSampleStats< T >::Add ( const std::vector< T > &  X,
const std::vector< T > &  Y 
)
inline

Add two std::vectors of data to the statistics.

Definition at line 897 of file Stats.hpp.

◆ Add() [2/3]

template<class T >
void gnsstk::TwoSampleStats< T >::Add ( const T &  x,
const T &  y 
)
inline

Add data to the statistics NB this is the fundamental Add routine; all other Add's call this

Definition at line 867 of file Stats.hpp.

◆ Add() [3/3]

template<class T >
void gnsstk::TwoSampleStats< T >::Add ( const Vector< T > &  X,
const Vector< T > &  Y 
)
inline

Add two gnsstk::Vector<T>s of data to the statistics.

Definition at line 890 of file Stats.hpp.

◆ asShortString()

template<class T >
std::string gnsstk::TwoSampleStats< T >::asShortString ( std::string  msg = std::string(),
int  w = 0,
int  p = 3 
) const
inline

Write TwoSampleStats as a short 1-line string.

Definition at line 1018 of file Stats.hpp.

◆ asString()

template<class T >
std::string gnsstk::TwoSampleStats< T >::asString ( std::string  msg = std::string(),
int  w = 7,
int  p = 4 
) const
inline

Write TwoSampleStats to a three-line string.

Definition at line 1001 of file Stats.hpp.

◆ AverageX()

template<class T >
T gnsstk::TwoSampleStats< T >::AverageX ( void  ) const
inline

return computed X average

Definition at line 1047 of file Stats.hpp.

◆ AverageY()

template<class T >
T gnsstk::TwoSampleStats< T >::AverageY ( void  ) const
inline

return computed Y average

Definition at line 1049 of file Stats.hpp.

◆ Correlation()

template<class T >
T gnsstk::TwoSampleStats< T >::Correlation ( void  ) const
inline

return correlation

Definition at line 1093 of file Stats.hpp.

◆ Dump()

template<class T >
void gnsstk::TwoSampleStats< T >::Dump ( std::vector< unsigned int > &  vuint,
std::vector< T > &  vT 
)
inline

Dump TwoSampleStats private members directly; useful in saving an object (e.g. to a file); reload with Load().

Parameters
vuintoutput vector<unsigned int> of length 5, input of Load()
vToutput vector<T> of length 11, input of Load()

Definition at line 951 of file Stats.hpp.

◆ Evaluate()

template<class T >
T gnsstk::TwoSampleStats< T >::Evaluate ( x) const
inline

return the predicted Y at the given X, using Slope and Intercept

Definition at line 1121 of file Stats.hpp.

◆ Intercept()

template<class T >
T gnsstk::TwoSampleStats< T >::Intercept ( void  ) const
inline

return intercept of best-fit line Y=slope*X + intercept

Definition at line 1072 of file Stats.hpp.

◆ Load()

template<class T >
void gnsstk::TwoSampleStats< T >::Load ( std::vector< unsigned int > &  vuint,
std::vector< T > &  vT 
)
inline

Define TwoSampleStats private members directly; useful in continuing with an object that was earlier saved (e.g. to a file) using Dump().

Parameters
vuintinput vector<unsigned int> of length 5, output of Dump()
vTinput vector<T> of length 11, output of Dump() NB no checking at all - caller has burden of validity NB zero-fill rather than throwing

Definition at line 977 of file Stats.hpp.

◆ MaximumX()

template<class T >
T gnsstk::TwoSampleStats< T >::MaximumX ( void  ) const
inline

return maximum X value

Definition at line 1041 of file Stats.hpp.

◆ MaximumY()

template<class T >
T gnsstk::TwoSampleStats< T >::MaximumY ( void  ) const
inline

return maximum Y value

Definition at line 1045 of file Stats.hpp.

◆ MinimumX()

template<class T >
T gnsstk::TwoSampleStats< T >::MinimumX ( void  ) const
inline

return minimum X value

Definition at line 1039 of file Stats.hpp.

◆ MinimumY()

template<class T >
T gnsstk::TwoSampleStats< T >::MinimumY ( void  ) const
inline

return minimum Y value

Definition at line 1043 of file Stats.hpp.

◆ N()

template<class T >
unsigned int gnsstk::TwoSampleStats< T >::N ( void  ) const
inline

access the sample size NB. n should match SX.N() and SY.N() at all times

Definition at line 1037 of file Stats.hpp.

◆ operator+=()

template<class T >
TwoSampleStats<T>& gnsstk::TwoSampleStats< T >::operator+= ( TwoSampleStats< T > &  TSS)
inline

combine two TwoSampleStats (assumed to be taken from the same or equivalent ensembles)

Definition at line 921 of file Stats.hpp.

◆ operator-=()

template<class T >
TwoSampleStats<T>& gnsstk::TwoSampleStats< T >::operator-= ( TwoSampleStats< T > &  TSS)
inline

remove one WtdStats from another, assumed to be taken from the same or equivalent ensembles. NB. Assumes that these samples were previously added. NB. Minimum() and Maximum() may no longer be valid.

Definition at line 935 of file Stats.hpp.

◆ Reset()

template<class T >
void gnsstk::TwoSampleStats< T >::Reset ( void  )
inline

reset, i.e. ignore earlier data and restart sampling

Definition at line 856 of file Stats.hpp.

◆ SigmaSlope()

template<class T >
T gnsstk::TwoSampleStats< T >::SigmaSlope ( void  ) const
inline

return uncertainty in slope

Definition at line 1081 of file Stats.hpp.

◆ SigmaYX()

template<class T >
T gnsstk::TwoSampleStats< T >::SigmaYX ( void  ) const
inline

return conditional uncertainty = uncertainty y given x

Definition at line 1105 of file Stats.hpp.

◆ Slope()

template<class T >
T gnsstk::TwoSampleStats< T >::Slope ( void  ) const
inline

return slope of best-fit line Y=slope*X + intercept

Definition at line 1060 of file Stats.hpp.

◆ StdDevX()

template<class T >
T gnsstk::TwoSampleStats< T >::StdDevX ( void  ) const
inline

return computed X standard deviation

Definition at line 1055 of file Stats.hpp.

◆ StdDevY()

template<class T >
T gnsstk::TwoSampleStats< T >::StdDevY ( void  ) const
inline

return computed Y standard deviation

Definition at line 1057 of file Stats.hpp.

◆ Subtract() [1/3]

template<class T >
void gnsstk::TwoSampleStats< T >::Subtract ( const std::vector< T > &  X,
const std::vector< T > &  Y 
)
inline

Subtract two std::vectors of data from the statistics.

Definition at line 911 of file Stats.hpp.

◆ Subtract() [2/3]

template<class T >
void gnsstk::TwoSampleStats< T >::Subtract ( const T &  x,
const T &  y 
)
inline

Subtract data from the statistics NB this is the fundamental Subtract routine; all others call this NB. Assumes that these samples were previously added. NB. Minimum() and Maximum() may no longer be valid.

Definition at line 879 of file Stats.hpp.

◆ Subtract() [3/3]

template<class T >
void gnsstk::TwoSampleStats< T >::Subtract ( const Vector< T > &  X,
const Vector< T > &  Y 
)
inline

Subtract two gnsstk::Vector<T>s of data from the statistics.

Definition at line 904 of file Stats.hpp.

◆ VarianceX()

template<class T >
T gnsstk::TwoSampleStats< T >::VarianceX ( void  ) const
inline

return computed X variance

Definition at line 1051 of file Stats.hpp.

◆ VarianceY()

template<class T >
T gnsstk::TwoSampleStats< T >::VarianceY ( void  ) const
inline

return computed Y variance

Definition at line 1053 of file Stats.hpp.

◆ VarianceYX()

template<class T >
T gnsstk::TwoSampleStats< T >::VarianceYX ( void  ) const
inline

return conditional variance = (uncertainty y given x)^2

Definition at line 1111 of file Stats.hpp.

Member Data Documentation

◆ n

template<class T >
unsigned int gnsstk::TwoSampleStats< T >::n
protected

number of samples added to the statistics

Definition at line 1129 of file Stats.hpp.

◆ sumxy

template<class T >
T gnsstk::TwoSampleStats< T >::sumxy
protected

sum of x*y

Definition at line 1130 of file Stats.hpp.

◆ SX

template<class T >
Stats<T> gnsstk::TwoSampleStats< T >::SX
protected

conventional 1-sample stats for first sample x

Definition at line 1127 of file Stats.hpp.

◆ SY

template<class T >
Stats<T> gnsstk::TwoSampleStats< T >::SY
protected

conventional 1-sample stats for second sample y

Definition at line 1128 of file Stats.hpp.


The documentation for this class was generated from the following file:


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:46