Skip to main content
replaced http://stats.stackexchange.com/ with https://stats.stackexchange.com/
Source Link

I have results from the same test applied to two independent samples:

x <- c(17, 12, 13, 16, 9, 19, 21, 12, 18, 17)
y <- c(10, 6, 15, 9, 8, 11, 8, 16, 13, 7, 5, 14)

And I want to compute a Wilcoxon rank sum test.

When I calculate the statistic $T_{W}$ by hand, I get: $$ T_{W}=\sum\text{rank}(X_{i}) = 156.5 $$

When I let R perform a wilcox.test(x, y, correct = F), I get:

W = 101.5

Why is that? Shouldn't the statistic $W^{+}$ only be returned when I perform a signed rank test with paired = T? Or do I misunderstand the rank sum test?

How can I tell R to output $T_{W}$


As part of the test results, not through something like:

dat <- data.frame(v = c(x, y), s = factor(rep(c("x", "y"), c(10, 12))))
dat$r <- rank(dat$v)
T.W <- sum(dat$r[dat$s == "x"])

I asked a follow up question about the meaning of the Different ways to calculate the test statistic for the Wilcoxon rank sum testDifferent ways to calculate the test statistic for the Wilcoxon rank sum test

I have results from the same test applied to two independent samples:

x <- c(17, 12, 13, 16, 9, 19, 21, 12, 18, 17)
y <- c(10, 6, 15, 9, 8, 11, 8, 16, 13, 7, 5, 14)

And I want to compute a Wilcoxon rank sum test.

When I calculate the statistic $T_{W}$ by hand, I get: $$ T_{W}=\sum\text{rank}(X_{i}) = 156.5 $$

When I let R perform a wilcox.test(x, y, correct = F), I get:

W = 101.5

Why is that? Shouldn't the statistic $W^{+}$ only be returned when I perform a signed rank test with paired = T? Or do I misunderstand the rank sum test?

How can I tell R to output $T_{W}$


As part of the test results, not through something like:

dat <- data.frame(v = c(x, y), s = factor(rep(c("x", "y"), c(10, 12))))
dat$r <- rank(dat$v)
T.W <- sum(dat$r[dat$s == "x"])

I asked a follow up question about the meaning of the Different ways to calculate the test statistic for the Wilcoxon rank sum test

I have results from the same test applied to two independent samples:

x <- c(17, 12, 13, 16, 9, 19, 21, 12, 18, 17)
y <- c(10, 6, 15, 9, 8, 11, 8, 16, 13, 7, 5, 14)

And I want to compute a Wilcoxon rank sum test.

When I calculate the statistic $T_{W}$ by hand, I get: $$ T_{W}=\sum\text{rank}(X_{i}) = 156.5 $$

When I let R perform a wilcox.test(x, y, correct = F), I get:

W = 101.5

Why is that? Shouldn't the statistic $W^{+}$ only be returned when I perform a signed rank test with paired = T? Or do I misunderstand the rank sum test?

How can I tell R to output $T_{W}$


As part of the test results, not through something like:

dat <- data.frame(v = c(x, y), s = factor(rep(c("x", "y"), c(10, 12))))
dat$r <- rank(dat$v)
T.W <- sum(dat$r[dat$s == "x"])

I asked a follow up question about the meaning of the Different ways to calculate the test statistic for the Wilcoxon rank sum test

edited tags
Link
amoeba
  • 107.2k
  • 36
  • 321
  • 346
Added Latex markup
Source Link
COOLSerdash
  • 31.2k
  • 10
  • 104
  • 157

I have results from the same test applied to two independent samples:

x <- c(17, 12, 13, 16, 9, 19, 21, 12, 18, 17)
y <- c(10, 6, 15, 9, 8, 11, 8, 16, 13, 7, 5, 14)

And I want to compute a Wilcoxon rank sum test.

When I calculate the statistic TW$T_{W}$ by hand, I get:

TW = ∑ rank ( Xi ) = 156.5 $$ T_{W}=\sum\text{rank}(X_{i}) = 156.5 $$

When I let R perform a wilcox.test(x, y, correct = F), I get:

W = 101.5

Why is that? Shouldn't the statistic W+$W^{+}$ only be returned when I perform a signed rank test with paired = T? Or do I misunderstand the rank sum test?

How can I tell R to output TW?$T_{W}$


As part of the test results, not through something like:

dat <- data.frame(v = c(x, y), s = factor(rep(c("x", "y"), c(10, 12))))
dat$r <- rank(dat$v)
T.W <- sum(dat$r[dat$s == "x"])

I asked a follow up question about the meaning of the Different ways to calculate the test statistic for the Wilcoxon rank sum test

I have results from the same test applied to two independent samples:

x <- c(17, 12, 13, 16, 9, 19, 21, 12, 18, 17)
y <- c(10, 6, 15, 9, 8, 11, 8, 16, 13, 7, 5, 14)

And I want to compute a Wilcoxon rank sum test.

When I calculate the statistic TW by hand, I get:

TW = ∑ rank ( Xi ) = 156.5

When I let R perform a wilcox.test(x, y, correct = F), I get:

W = 101.5

Why is that? Shouldn't the statistic W+ only be returned when I perform a signed rank test with paired = T? Or do I misunderstand the rank sum test?

How can I tell R to output TW?


As part of the test results, not through something like:

dat <- data.frame(v = c(x, y), s = factor(rep(c("x", "y"), c(10, 12))))
dat$r <- rank(dat$v)
T.W <- sum(dat$r[dat$s == "x"])

I asked a follow up question about the meaning of the Different ways to calculate the test statistic for the Wilcoxon rank sum test

I have results from the same test applied to two independent samples:

x <- c(17, 12, 13, 16, 9, 19, 21, 12, 18, 17)
y <- c(10, 6, 15, 9, 8, 11, 8, 16, 13, 7, 5, 14)

And I want to compute a Wilcoxon rank sum test.

When I calculate the statistic $T_{W}$ by hand, I get: $$ T_{W}=\sum\text{rank}(X_{i}) = 156.5 $$

When I let R perform a wilcox.test(x, y, correct = F), I get:

W = 101.5

Why is that? Shouldn't the statistic $W^{+}$ only be returned when I perform a signed rank test with paired = T? Or do I misunderstand the rank sum test?

How can I tell R to output $T_{W}$


As part of the test results, not through something like:

dat <- data.frame(v = c(x, y), s = factor(rep(c("x", "y"), c(10, 12))))
dat$r <- rank(dat$v)
T.W <- sum(dat$r[dat$s == "x"])

I asked a follow up question about the meaning of the Different ways to calculate the test statistic for the Wilcoxon rank sum test

added 193 characters in body
Source Link
user14650
user14650
Loading
added 12 characters in body
Source Link
user14650
user14650
Loading
code format
Source Link
user14650
user14650
Loading
Source Link
user14650
user14650
Loading