I am not a regular R user so I'm struggling a bit on how to get an exact p-value and confidence limits for a single sample using the Wilcoxon Signed-Rank test. wilcox.test does not handle ties so it's automatically defaulting to normal approximation, but I have very small samples I am dealing with so need an exact estimate.
What is the equivalent of wilcox.test(y, alternative = c("greater"), correct = TRUE) for a single vector in wilcox_test from the coin package?
This is a paired sample problem...
I get all kinds of errors even when I follow the examples from the documentation
data("ToothGrowth")
df <- ToothGrowth
df %>% wilcox_test(len ~ 1, mu = 0)
Error in UseMethod("wilcox_test") :
no applicable method for 'wilcox_test' applied to an object of class "data.frame"
coinpackage into yourRenvironment? – whuber Aug 07 '20 at 17:19coininterface is made for the paired situation with two vectors. If you already end up with a vector of differences, you can invent a vector of 0 to play the role of the second vector. This is a bit a hacky solution, but it works:library(coin); x <- -3:10; zeros <- rep(0, length(x)); wilcoxsign_test(x ~ zeros, distribution = "exact")(sorry for the formatting, but answering a closed question is not possible for me). – Michael M Aug 07 '20 at 18:54