grouped_wilcox: Function to run two-sample Wilcoxon tests on multiple...

Description Usage Arguments Value See Also Examples

View source: R/grouped_wilcox.R

Description

Function to run two-sample Wilcoxon tests on multiple variables across multiple grouping variables.

Running Wilcox test across multiple grouping variables.

Usage

1
2
3
4
5
6
7
8
grouped_wilcox(
  data,
  dep.vars,
  indep.vars,
  grouping.vars,
  paired = FALSE,
  correct = TRUE
)

Arguments

data

Dataframe from which variables are to be taken.

dep.vars

List dependent variables for a two-sample Wilcoxon tests (y in y ~ x).

indep.vars

List independent variables for a two-sample Wilcoxon tests (x in y ~ x).

grouping.vars

List of grouping variables (if NULL, the entire dataframe will be used).

paired

A logical indicating whether you want a paired two-sample Wilcoxon tests (Default: paired = FALSE).

correct

A logical indicating whether to apply continuity correction in the normal approximation for the p-value (Default: correct = TRUE).

Value

A tibble dataframe with tidy results from two-sample Wilcoxon tests analyses.

See Also

grouped_tidy

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 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
)

Example output

Registered S3 method overwritten by 'broom.mixed':
  method      from 
  tidy.gamlss broom
# 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     depthWilco380600  -2.00e-1 -3.00e-1  -3.64e-5 1.54e- 2
 2 SI1     depthWilco918892   3.93e-5 -1.00e-1   1.00e-1 6.77e- 1
 3 VS1     depthWilco276743  -4.00e-1 -5.00e-1  -3.00e-1 7.03e-12
 4 VVS2    depthWilco52618  -4.00e-1 -6.00e-1  -2.00e-1 4.18e- 4
 5 VS2     depthWilco816784. -2.00e-1 -3.00e-1  -1.00e-1 8.86e- 5
 6 I1      depthWilco1570. -2.00e+0 -3.00e+0  -1.00e+0 1.21e- 4
 7 VVS1    depthWilco19455  -3.00e-1 -5.00e-1  -1.00e-1 5.07e- 3
 8 IF      depthWilco3286  -3.00e-1 -7.00e-1  -2.51e-5 4.79e- 2
 9 SI2     tableWilco388138. -2.08e-5 -3.91e-5   4.98e-6 6.85e- 2
10 SI1     tableWilco880016.  0.      -1.30e-5   3.62e-5 1.71e- 1
11 VS1     tableWilco306400  -4.82e-6 -1.00e+0  -2.87e-5 6.16e- 5
12 VVS2    tableWilco54524  -1.00e+0 -1.00e+0  -5.87e-5 2.60e- 3
13 VS2     tableWilco763942. -1.00e+0 -1.00e+0  -4.61e-5 1.65e-10
14 I1      tableWilco2900   1.00e+0 -2.80e-5   2.00e+0 1.68e- 1
15 VVS1    tableWilco22659  -7.72e-6 -1.00e+0   4.05e-6 3.42e- 1
16 IF      tableWilco3987  -3.35e-5 -1.00e+0   1.00e+0 9.11e- 1
# … with 1 more variable: significance <chr>

groupedstats documentation built on May 29, 2021, 1:06 a.m.