2023-01-23 21:13:26 +01:00
|
|
|
//
|
|
|
|
// HypothesisTesting.cpp
|
|
|
|
//
|
|
|
|
// Created by Marc Melikyan on 3/10/21.
|
|
|
|
//
|
|
|
|
|
2023-01-24 18:12:23 +01:00
|
|
|
#include "hypothesis_testing.h"
|
2023-01-23 21:13:26 +01:00
|
|
|
|
2023-01-24 19:20:18 +01:00
|
|
|
|
2023-01-23 21:13:26 +01:00
|
|
|
|
2023-01-27 13:01:16 +01:00
|
|
|
std::tuple<bool, real_t> MLPPHypothesisTesting::chiSquareTest(std::vector<real_t> observed, std::vector<real_t> expected) {
|
|
|
|
real_t df = observed.size() - 1; // These are our degrees of freedom
|
|
|
|
real_t sum = 0;
|
2023-01-24 19:00:54 +01:00
|
|
|
for (int i = 0; i < observed.size(); i++) {
|
|
|
|
sum += (observed[i] - expected[i]) * (observed[i] - expected[i]) / expected[i];
|
|
|
|
}
|
|
|
|
}
|
2023-01-23 21:13:26 +01:00
|
|
|
|