Skip to content

Commit

Permalink
Merge pull request #235 from joshuaehill/iidReporting
Browse files Browse the repository at this point in the history
Consistently run both the chi-square independence and chi-square goodness-of-fit tests
  • Loading branch information
celic authored Jul 12, 2024
2 parents 8fadb3d + 6016199 commit 68ed165
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cpp/iid/chi_square_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ bool chi_square_tests(const uint8_t data[], const int sample_size, const int alp
double score = 0.0;
double pvalue;
int df = 0;
bool result = true;

// Chi Square independence test
if(alphabet_size == 2){
Expand All @@ -661,7 +662,7 @@ bool chi_square_tests(const uint8_t data[], const int sample_size, const int alp

// Check result to return if test failed
if(pvalue < 0.001){
return false;
result = false;
}

// Reset score and df
Expand Down Expand Up @@ -691,8 +692,8 @@ bool chi_square_tests(const uint8_t data[], const int sample_size, const int alp

// Check result to return if test failed
if(pvalue < 0.001){
return false;
result = false;
}

return true;
return result;
}

0 comments on commit 68ed165

Please sign in to comment.