R/grouped_wilcox.R
grouped_wilcox.Rd
Function to run two-sample Wilcoxon tests on multiple variables across multiple grouping variables.
Running Wilcox test across multiple grouping variables.
grouped_wilcox( data, dep.vars, indep.vars, grouping.vars, paired = FALSE, correct = TRUE )
data | Dataframe from which variables are to be taken. |
---|---|
dep.vars | List dependent variables for a two-sample Wilcoxon tests ( |
indep.vars | List independent variables for a two-sample Wilcoxon tests
( |
grouping.vars | List of grouping variables (if |
paired | A logical indicating whether you want a paired two-sample
Wilcoxon tests (Default: |
correct | A logical indicating whether to apply continuity correction in
the normal approximation for the p-value (Default: |
A tibble dataframe with tidy results from two-sample Wilcoxon tests analyses.
# for reproducibility set.seed(123) # only with one grouping variable groupedstats::grouped_wilcox( data = dplyr::filter(.data = ggplot2::diamonds, color == "E" | color == "J"), dep.vars = depth:table, indep.vars = color, grouping.vars = clarity, paired = FALSE )#> # A tibble: 16 x 9 #> clarity formula method statistic estimate conf.low conf.high p.value #> <ord> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 SI2 depth ~… Wilcoxon ran… 380600 -2.00e-1 -3.00e-1 -3.64e-5 1.54e- 2 #> 2 SI1 depth ~… Wilcoxon ran… 918892 3.93e-5 -1.00e-1 1.00e-1 6.77e- 1 #> 3 VS1 depth ~… Wilcoxon ran… 276743 -4.00e-1 -5.00e-1 -3.00e-1 7.03e-12 #> 4 VVS2 depth ~… Wilcoxon ran… 52618 -4.00e-1 -6.00e-1 -2.00e-1 4.18e- 4 #> 5 VS2 depth ~… Wilcoxon ran… 816784. -2.00e-1 -3.00e-1 -1.00e-1 8.86e- 5 #> 6 I1 depth ~… Wilcoxon ran… 1570. -2.00e+0 -3.00e+0 -1.00e+0 1.21e- 4 #> 7 VVS1 depth ~… Wilcoxon ran… 19455 -3.00e-1 -5.00e-1 -1.00e-1 5.07e- 3 #> 8 IF depth ~… Wilcoxon ran… 3286 -3.00e-1 -7.00e-1 -2.51e-5 4.79e- 2 #> 9 SI2 table ~… Wilcoxon ran… 388138. -2.08e-5 -3.91e-5 4.98e-6 6.85e- 2 #> 10 SI1 table ~… Wilcoxon ran… 880016. 0 -1.30e-5 3.62e-5 1.71e- 1 #> 11 VS1 table ~… Wilcoxon ran… 306400 -4.82e-6 -1.00e+0 -2.87e-5 6.16e- 5 #> 12 VVS2 table ~… Wilcoxon ran… 54524 -1.00e+0 -1.00e+0 -5.87e-5 2.60e- 3 #> 13 VS2 table ~… Wilcoxon ran… 763942. -1.00e+0 -1.00e+0 -4.61e-5 1.65e-10 #> 14 I1 table ~… Wilcoxon ran… 2900 1.00e+0 -2.80e-5 2.00e+0 1.68e- 1 #> 15 VVS1 table ~… Wilcoxon ran… 22659 -7.72e-6 -1.00e+0 4.05e-6 3.42e- 1 #> 16 IF table ~… Wilcoxon ran… 3987 -3.35e-5 -1.00e+0 1.00e+0 9.11e- 1 #> # … with 1 more variable: significance <chr>