Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: effectsize
Title: Indices of Effect Size
Version: 1.0.3
Version: 1.0.3.1
Authors@R:
c(person(given = "Mattan S.",
family = "Ben-Shachar",
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# effectsize (dev)

## Bug fixes

- `rank_biserial(x, y, paired = TRUE)` gives the same CIs as `rank_biserial(x - y)` (#716)


# effectsize 1.0.3

## Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion R/rank_diff.R
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ rank_biserial <- function(

rank_f <- atanh(r_rbs)
if (is_paired_or_onesample) {
nd <- sum((x - mu) != 0)
nd <- sum((x - y) - mu != 0)
maxw <- (nd^2 + nd) / 2

# From: https://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test#Historical_T_statistic/
Expand Down
10 changes: 5 additions & 5 deletions tests/testthat/test-rankES.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
test_that("rank_biserial", {
x <- c(1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30)
y <- c(0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29)
x <- c(5.1, 6.0, 7.2, 4.8, 6.5, 5.9, 7.0, 6.1, 5.5, 6.3)
y <- c(4.9, 6.0, 6.5, 4.8, 6.8, 5.3, 6.1, 6.1, 5.9, 5.0)

rRB1 <- rank_biserial(x, y, paired = TRUE)
rRB2 <- rank_biserial(x - y)

expect_equal(rRB1, rRB2, ignore_attr = TRUE)
expect_equal(rRB1[[1]], 0.777, tolerance = 0.01)
expect_equal(rRB1$CI_low, 0.2953631, tolerance = 0.01)
expect_equal(rRB1$CI_high, 0.9441559, tolerance = 0.01)
expect_equal(rRB1[[1]], 0.6428571, tolerance = 0.01)
expect_equal(rRB1$CI_low, -0.06511553, tolerance = 0.01)
expect_equal(rRB1$CI_high, 0.9203429, tolerance = 0.01)

A <- c(48, 48, 77, 86, 85, 85, 16)
B <- c(14, 34, 34, 77)
Expand All @@ -27,7 +27,7 @@
x1 <- x[1:5]
x2 <- x[6:15]

expect_equal(

Check warning on line 30 in tests/testthat/test-rankES.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=tests/testthat/test-rankES.R,line=30,col=3,[expect_identical_linter] Use expect_identical(x, y) by default; resort to expect_equal() only when needed, e.g. when setting ignore_attr= or tolerance=.
rank_biserial(x1, x2),
rank_biserial(as.numeric(x1), as.numeric(x2))
)
Expand All @@ -52,7 +52,7 @@

expect_equal(E[[1]], 0.05934066, tolerance = 0.01)
expect_equal(E$CI_low, 0.01726463, tolerance = 0.01)
expect_equal(E$CI_high, 1)

Check warning on line 55 in tests/testthat/test-rankES.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=tests/testthat/test-rankES.R,line=55,col=3,[expect_identical_linter] Use expect_identical(x, y) by default; resort to expect_equal() only when needed, e.g. when setting ignore_attr= or tolerance=.
})


Expand All @@ -66,7 +66,7 @@

expect_equal(E[[1]], 0.82, tolerance = 0.01)
expect_equal(E$CI_low, 0.78, tolerance = 0.01)
expect_equal(E$CI_high, 1)

Check warning on line 69 in tests/testthat/test-rankES.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=tests/testthat/test-rankES.R,line=69,col=3,[expect_identical_linter] Use expect_identical(x, y) by default; resort to expect_equal() only when needed, e.g. when setting ignore_attr= or tolerance=.
})

test_that("kendalls_w", {
Expand Down Expand Up @@ -272,17 +272,17 @@
)

expect_warning(kendalls_w(m, ci = NULL), "contain ties")
expect_warning(W <- kendalls_w(m, ci = NULL), "unique ranking")

Check warning on line 275 in tests/testthat/test-rankES.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=tests/testthat/test-rankES.R,line=275,col=18,[implicit_assignment_linter] Avoid implicit assignments in function calls. For example, instead of `if (x <- 1L) { ... }`, write `x <- 1L; if (x) { ... }`.
expect_equal(W[[1]], 0.4666667, tolerance = 0.001)
expect_equal(

Check warning on line 277 in tests/testthat/test-rankES.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=tests/testthat/test-rankES.R,line=277,col=3,[expect_identical_linter] Use expect_identical(x, y) by default; resort to expect_equal() only when needed, e.g. when setting ignore_attr= or tolerance=.
kendalls_w(t(m), blocks_on_rows = FALSE, ci = NULL, verbose = FALSE)[[1]],
W[[1]]
)

m[1, 1] <- NA
warns <- capture_warnings(W1 <- kendalls_w(m, ci = NULL))

Check warning on line 283 in tests/testthat/test-rankES.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=tests/testthat/test-rankES.R,line=283,col=29,[implicit_assignment_linter] Avoid implicit assignments in function calls. For example, instead of `if (x <- 1L) { ... }`, write `x <- 1L; if (x) { ... }`.
expect_match(warns[1], "dropped")
expect_equal(W1, kendalls_w(m[, -1], ci = NULL, verbose = FALSE))

Check warning on line 285 in tests/testthat/test-rankES.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=tests/testthat/test-rankES.R,line=285,col=3,[expect_identical_linter] Use expect_identical(x, y) by default; resort to expect_equal() only when needed, e.g. when setting ignore_attr= or tolerance=.

d <- data.frame(
y = OrchardSprays$decrease,
Expand Down
Loading