I have a within-subjects dataset for which I am running pairwise comparisons on a dependent variable that is be separated into four groups. I have the data organized long-ways and wide-ways:

Example long-ways:

direction count
l2l 44
l2l 49
r2r 100
r2r 582
r2l 24
r2l 1000
l2r 3
l2r 244

Example wide-ways:

l2l_count r2r_count r2l_count l2r_count
44 100 24 3
49 582 1000 244

I am interested in looking at every possible pairwise comparison on the variable "count" based on the grouping variable "direction" in R. However, I cannot figure out how to do this in R in an automated fashion.

With a data.frame called hcp_dir, I have tried using the following with my long-ways data:

pairwise.wilcox.test(hcp_dir$count, hcp_dir$direction, paired = TRUE, p.adj="bonf")

enter image description here

However, this only gives me a matrix of corrected p-values for every possible comparison, and does not yield a test statistic, which I need.

I have also tried using the following, which gives me bootstrapped confidence intervals, and an effect size, but no test statistic with long-ways oriented data:

wilcox_effsize(hcp_dir, count~direction, paired = TRUE, alternative = "two.sided", mu = 0, ci = TRUE, conf.level = 0.95, ci.type = "perc", nboot = 10000)

enter image description here

The only way I can figure out how to get a test statistic for the Wilcoxon sign-rank test is to use the following code, which requires the data to be organized wide-ways. It is ultimately with this script that I cannot figure out how to iterate through every possible direction pairing automatically.

wilcox.test(hcp_dir$l2l_count, hcp_dir$r2r_count, paired = TRUE, alternative = "two.sided")

enter image description here

Note that this is the only way I am able to get a V statistic. I need to figure out how to iterate across all possible comparisons for efficiency.

0

There are 0 best solutions below