-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FR: Add group medians for Wilcoxon rank sum test in model_parameters
#492
Comments
Note that It returns group means for Welch two-sample test because the underlying object contains them. library(parameters)
x <- c(1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30)
y <- c(0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29)
mod1 <- t.test(x, y, paired = TRUE)
mod1
#>
#> Paired t-test
#>
#> data: x and y
#> t = 3.0354, df = 8, p-value = 0.01618
#> alternative hypothesis: true difference in means is not equal to 0
#> 95 percent confidence interval:
#> 0.1037787 0.7599991
#> sample estimates:
#> mean of the differences
#> 0.4318889
parameters(mod1)
#> Paired t-test
#>
#> Parameter | Group | Difference | t(8) | p | 95% CI
#> ------------------------------------------------------------
#> x | y | 0.43 | 3.04 | 0.016 | [0.10, 0.76] But it doesn't do so for Wilcoxon rank sum test because the object doesn't contain them: mod2 <- wilcox.test(x, y, paired = TRUE)
mod2
#>
#> Wilcoxon signed rank exact test
#>
#> data: x and y
#> V = 40, p-value = 0.03906
#> alternative hypothesis: true location shift is not equal to 0
parameters(mod2)
#> Wilcoxon signed rank exact test
#>
#> Parameter1 | Parameter2 | W | p
#> ---------------------------------------
#> x | y | 40.00 | 0.039 You can always add effect size information for these object though:
Created on 2021-05-13 by the reprex package (v2.0.0) |
Reopening in light of easystats/report#189 This will depend on whether we can recover data from the |
Something along these lines: x <- c(0.80, 0.83, 1.89, 1.04, 1.45, 1.38, 1.91, 1.64, 0.73, 1.46)
y <- c(1.15, 0.88, 0.90, 0.74, 1.21)
## wilcox.test ----
model <- wilcox.test(x, y)
data <- insight::get_data(model)
desc <- NULL
if (!is.null(data)) {
desc <- as.data.frame(t(sapply(data, function(d) {
data.frame(Median = median(d, na.rm = TRUE),
MAD = mad(d, na.rm = TRUE))
})))
}
desc
#> Median MAD
#> x 1.415 0.630105
#> y 0.9 0.237216
## wilcox.test ----
model <- t.test(x, y)
data <- insight::get_data(model)
desc <- NULL
if (!is.null(data)) {
desc <- as.data.frame(t(sapply(data, function(d) {
data.frame(Mean = mean(d, na.rm = TRUE),
SD = sd(d, na.rm = TRUE))
})))
}
desc
#> Mean SD
#> x 1.313 0.4412117
#> y 0.976 0.1973069 Created on 2021-06-17 by the reprex package (v2.0.0) |
As
model_parameters
shows group means for Welch two-sample test, it could also show group medians for Wilcoxon rank sum test.The text was updated successfully, but these errors were encountered: