AngusMcLure / PoolPoweR

Power and sample size calculations for surveys using pool testing (AKA group testing)
GNU General Public License v3.0
0 stars 1 forks source link

Check `fi_pool_cluster` calculations #30

Closed fredjaya closed 12 months ago

fredjaya commented 12 months ago

One for you Angus.

When running this test/input parameters:

test_that("fi_pool_cluster() when real_scale", {
  expect_equal(fi_pool_cluster(
    pool_size = 10, pool_number = 5, prevalence = 0.01, correlation = 0.05,
    sensitivity = 0.95, specificity = 0.99, form = "cloglognorm", real_scale = T),
    matrix(c(0.3152587, 0.2093284, 0.2093284, 0.2246682), nrow = 2),
    tolerance = 1e-7)
})

It now provides different matrix values:

── Failure ('test-fisher_information.R:97:3'): fi_pool_cluster() when real_scale ──
fi_pool_cluster(...) (`actual`) not equal to matrix(c(0.3152587, 0.2093284, 0.2093284, 0.2246682), nrow = 2) (`expected`)
actual vs expected
                     [,1]      [,2]
- actual[1, ]   0.1536556 0.1461399
+ expected[1, ] 0.3152587 0.2093284
- actual[2, ]   0.1461399 0.2246681
+ expected[2, ] 0.2093284 0.2246682
AngusMcLure commented 12 months ago

I've checked this and I am satisfied that the new values are correct. I have corrected the test with 0297836, and it now passes this test (still failing the test at issue in #29)