Skip to content

Commit

Permalink
Replace t-test with chi-squared test.
Browse files Browse the repository at this point in the history
The t-test was checking that the frequency mean matches the expected
value, but that test is instead looking at whether all values are
uniformly distributed.

It would be possible for values to have the right average but not a
uniform distribution. A chi-squared test is more suited for this.
  • Loading branch information
plietar committed Feb 29, 2024
1 parent b3c667a commit f3317ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/testthat/test-bitset.R
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ test_that("bitset is evenly sampled", {
xs <- b$to_vector()
freqs[xs] <- freqs[xs] + 1
}
p <- t.test(freqs, mu=rate*N)$p.value
p <- chisq.test(freqs)$p.value
expect_gt(p, threshold)
}
})
Expand Down

0 comments on commit f3317ca

Please sign in to comment.