yat  0.20.3pre
Classes | Public Member Functions | List of all members
theplu::yat::statistics::Chi2 Class Reference

Chi squared test. More...

#include <yat/statistics/Chi2.h>

Public Member Functions

unsigned int dof (void) const
 
const utility::Matrixexpected (void) const
 
double p_value (void) const
 
double p_value (size_t N) const
 
double operator() (void)
 
double operator() (const utility::MatrixBase &data)
 

Detailed Description

Chi squared test.

Since
New in yat 0.16

Member Function Documentation

◆ dof()

unsigned int theplu::yat::statistics::Chi2::dof ( void  ) const
Returns
degrees of freedom

◆ expected()

const utility::Matrix& theplu::yat::statistics::Chi2::expected ( void  ) const

The expected value in element ij is calculated as sum of values in row i times sum of values in column j divided by total sum of values.

Returns
expected values if there is no association between row and column

◆ operator()() [1/2]

double theplu::yat::statistics::Chi2::operator() ( void  )
Returns
Chi2 sum calculated previously calling operator(void)

◆ operator()() [2/2]

double theplu::yat::statistics::Chi2::operator() ( const utility::MatrixBase data)

Sum is calculated as

$ sum_{ij} \frac{ (X_{ij}-E_{ij})^2}{E_{ij}} $

where is X is data and E is matrix with expected values (see expected(void));

Returns
Chi2 sum

◆ p_value() [1/2]

double theplu::yat::statistics::Chi2::p_value ( void  ) const
Returns
two-sided p-value

◆ p_value() [2/2]

double theplu::yat::statistics::Chi2::p_value ( size_t  N) const

Randomise the data such that row sums and column sums are conserved and calculate chi-squared. Return fraction of time the randomised chi-squared is greater (or equal) than the chi-squared calculated on original data.

Parameters
Nnumber of randomisations

Complexity: N x M, where M is total number of samples


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

Generated on Sat Feb 18 2023 03:31:45 for yat by  doxygen 1.8.14