I get different confidence intervals when using the package statsExpressions
and the package rstatix
in a Wilcoxon paired signed-rank test. I think statsExpressions
uses rstatix
, so I don't understand the difference. The first gives 0.24 - 0.884, and the second 1 - 6.
library(tidyverse)
library(BSDA)
#> Loading required package: lattice
#>
#> Attaching package: 'BSDA'
#> The following object is masked from 'package:datasets':
#>
#> Orange
library(ggstatsplot)
#> You can cite this package as:
#> Patil, I. (2021). Visualizations with statistical details: The 'ggstatsplot' approach.
#> Journal of Open Source Software, 6(61), 3167, doi:10.21105/joss.03167
library(statsExpressions)
library(rstatix)
#>
#> Attaching package: 'rstatix'
#> The following object is masked from 'package:stats':
#>
#> filter
# make long format - tidy data
d <- Speed %>%
gather(key = "speed", value = "score", before, after)
# Compute Paired Samples Wilcoxon Signed Rank Test
# statsExpressions
two_sample_test(
data = d,
x = speed,
y = score,
subject.id = NULL,
type = "nonparametric",
paired = TRUE,
alternative = "two.sided",
k = 2L,
conf.level = 0.95,
effsize.type = "d",
var.equal = FALSE,
bf.prior = 0.707,
tr = 0.2,
nboot = 100L,
conf.int = TRUE
)
#> # A tibble: 1 × 14
#> parameter1 parameter2 statistic p.value method alternative
#> <chr> <chr> <dbl> <dbl> <chr> <chr>
#> 1 score speed 100. 0.0229 Wilcoxon signed rank test two.sided
#> effectsize estimate conf.level conf.low conf.high conf.method n.obs
#> <chr> <dbl> <dbl> <dbl> <dbl> <chr> <int>
#> 1 r (rank biserial) 0.675 0.95 0.240 0.884 normal 15
#> expression
#> <list>
#> 1 <language>
wilcox_test(
data = d,
formula = score ~ speed,
comparisons = NULL,
ref.group = NULL,
p.adjust.method = "holm",
paired = TRUE,
exact = NULL,
alternative = "two.sided",
mu = 0,
conf.level = 0.95,
detailed = TRUE
)
#> # A tibble: 1 × 12
#> estimate .y. group1 group2 n1 n2 statistic p conf.low conf.high
#> * <dbl> <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <dbl>
#> 1 3.50 score after before 15 15 100. 0.0229 1.00 6.00
#> # ℹ 2 more variables: method <chr>, alternative <chr>
Created on 2023-09-26 with reprex v2.0.2