yat  0.21pre
Public Member Functions | List of all members
theplu::yat::statistics::Anova Class Reference

one-way ANOVA More...

#include <yat/statistics/Anova.h>

Public Member Functions

 Anova (size_t n)
 
void add (double x, size_t g, long int n=1)
 add a data point More...
 
double F (void) const
 
size_t inter_df (void) const
 
size_t intra_df (void) const
 
double p_value (void) const
 
void reset (void)
 remove all data
 

Detailed Description

one-way ANOVA

One-way Analysis of Variance is an extension of a t-test to compare also more than two groups.

Since
New in yat 0.20

Constructor & Destructor Documentation

◆ Anova()

theplu::yat::statistics::Anova::Anova ( size_t  n)
Parameters
nnumber of groups compared

Member Function Documentation

◆ add()

void theplu::yat::statistics::Anova::add ( double  x,
size_t  g,
long int  n = 1 
)

add a data point

Parameters
xvalue of data point
ggroup the data belongs to
nnumber of data points

◆ F()

double theplu::yat::statistics::Anova::F ( void  ) const

F is calculated as the ratio between within-group variance and between-group variance.

$ \frac {\frac{1}{G-1} \sum_g^G n_g (m_g - m)^2} {\frac{1}{N-G} \sum_{g,i}^{G, n_G} (x_{g,i}-m_g)^2} $

If null hypothesis is true, F follows an F(a,b) distribution where a is inter_df() and b is intra_df.

◆ inter_df()

size_t theplu::yat::statistics::Anova::inter_df ( void  ) const

Number of samples minus one.

◆ intra_df()

size_t theplu::yat::statistics::Anova::intra_df ( void  ) const

Number of groups minus one

◆ p_value()

double theplu::yat::statistics::Anova::p_value ( void  ) const

Calculates the probability to get F (or larger) given the null hypothesis that there is no difference between the groups.

Returns
the one-sided p-value

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

Generated on Wed Jan 25 2023 03:34:29 for yat by  doxygen 1.8.14