Fix calculation of log-dice coefficient
Change-Id: Ie9c7669ad3383d78ca5e8850681f3ecf22fc1411
diff --git a/NEWS.md b/NEWS.md
index 8a55c12..ac90893 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,8 @@
+# RKorAPClient 0.6.1
+
+## Changes
+- fixes calculation of logDice coefficient
+
# RKorAPClient 0.6.0
## Changes
diff --git a/R/association-scores.R b/R/association-scores.R
index 2ab6021..31ab994 100644
--- a/R/association-scores.R
+++ b/R/association-scores.R
@@ -85,7 +85,7 @@
#'
logDice <- function(O1, O2, O, N, E, window_size) {
- 14 + log2(2 * O / (window_size * O2 + O1))
+ 14 + log2(2 * O / (window_size * O1 + O2))
}
diff --git a/tests/testthat/test-association-score-functions.R b/tests/testthat/test-association-score-functions.R
index 404478b..f7228d3 100644
--- a/tests/testthat/test-association-score-functions.R
+++ b/tests/testthat/test-association-score-functions.R
@@ -4,7 +4,7 @@
expect_that(x[["pmi"]], equals(2.886331, tolerance=0.01))
expect_that(x[["mi2"]], equals(7.886331, tolerance=0.01))
expect_that(x[["mi3"]], equals(12.886331, tolerance=0.01))
- expect_that(x[["logDice"]], equals(-2.029354, tolerance=0.01))
+ expect_that(x[["logDice"]], equals(-5.34404, tolerance=0.01))
x <- sapply(defaultAssociationScoreFunctions(), mapply, 4258869, 2165, 0, 21304641202, 4.327907, 10)
expect_that(x[["ll"]], equals(8.664477, tolerance=0.01))