microeco
microeco copied to clipboard
Error in KW_dunn (Dunn's Kruskal-Wallis Multiple Comparisons)
Dear Dr. Chi, I want to close the p-value correction or use another correction method. However, I tried the following codes, I got errors as shown below. So, I can't change the p-value correction method. I wonder how to solve this problem?
t1$cal_diff(method = "KW_dunn", p.adjustment.methods = NULL, KW_dunn_letter = FALSE) Error in dunn.test::dunn.test(x, g, method, TRUE, altp = altp, ...) : unused argument (p.adjustment.methods = NULL)
t1$cal_diff(method = "KW_dunn", p.adjustment.methods = "none", KW_dunn_letter = FALSE) Error in dunn.test::dunn.test(x, g, method, TRUE, altp = altp, ...) : unused argument (p.adjustment.methods = "none")
t1$cal_diff(method = "KW_dunn", p.adjustment.methods = "bonferroni", KW_dunn_letter = FALSE) Error in dunn.test::dunn.test(x, g, method, TRUE, altp = altp, ...) : unused argument (p.adjustment.methods = "bonferroni")
Hi @sdhorse
I carefully checked the codes I originally wrote and found that the p value adjustment for KW_dunn works only inside the invoked dunnTest function of FSA package. Now It is hard to change the settings by adjusting the parameters. So could you please change the p value correction by directly using the p.adjust
function in R like the example shows.
library(microeco)
data(dataset)
t1 <- trans_alpha$new(dataset = dataset, group = "Group")
t1$cal_diff(method = "KW_dunn", KW_dunn_letter = FALSE)
head(t1$res_diff)
# we change the output p.adj
# method can also be others, like "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr"
t1$res_diff$P.adj <- p.adjust(t1$res_diff$P.unadj, method = "none")
# reassign Significance
t1$res_diff$Significance <- cut(t1$res_diff$P.adj, breaks = c(-Inf, 0.001, 0.01, 0.05, Inf), label = c("***", "**", "*", "ns"))
Thanks very much for your finding! I will optimize this part for the KW_dunn method in the next version.