Skip to main content

StatsFtest

Namespace: STSLIB  ·  Library: Statistics Library

#include <sts/sts_ftest.h>

class STSLIB::StatsFtest

Provides F-test / one-way ANOVA implementation.

One-way ANOVA F-test with exact p-values via the regularised incomplete beta function.

src/examples/ex_sts_statistics/main.cpp
const StatsFtestResult anova = StatsFtest::oneWay({a, b, c}); // one-way ANOVA per column

Static Methods​

oneWay(groups)​

One-way ANOVA F-test.

Parameters:

  • groups : const QVector< Eigen::MatrixXd > & Vector of matrices, each n_observations x n_variables.

Returns:


fCdf(f, df1, df2)​

Compute the CDF of the F-distribution using the regularized incomplete beta function.

Parameters:

  • f : double The F-value.

  • df1 : int Numerator degrees of freedom.

  • df2 : int Denominator degrees of freedom.

Returns:

  • double — The probability P(F <= f).

Example​

Used in examples​

ex_sts_statistics​

Statistics library on small literal data sets with known answers.

src/examples/ex_sts_statistics/main.cpp, line 110
const StatsFtestResult anova = StatsFtest::oneWay({a, b, c}); // one-way ANOVA per column
// scipy.stats.f_oneway
ok &= expectRow(anova.matFstat, {31.736745886654532, 0.5648535564853556, 0.6174200661521498}, 1e-10, "F = scipy");
ok &= expectRow(anova.matPval, {4.076262200363868e-06, 0.5800772485078302, 0.5524898704594713}, 1e-10, "ANOVA p = scipy");
ok &= expect(anova.dfBetween == 2 && anova.dfWithin == 15, "df 2 and 15");

Authors of this file​