Rstatix: pairwise_chisq_test_against_p must sum to 1

39 Views Asked by At

I am trying to use the pairwise_chisq_test_against_p() function from the Rstatix package. I am doing this for a large dataset, where it mostly works fine, but I get the following error:

Error in pairwise_chisq_test_against_p(posClinSig, probVec) : Make sure that the p argument is correctly specified.sum of >probabilities must be 1.

This error seems pretty straightforward, however, when I try sum(probVec) I get [1] 1

Here are the underlying inputs:

posClinSig <- structure(c(Benign = 13L, Pathogenic = 27L, `Uncertain Significance` = 122L
), dim = 3L, dimnames = list(. = c("Benign", "Pathogenic", "Uncertain Significance"
)), class = "table")
probVec<-c(0.160463597779954, 0.627979105452171, 0.211557296767875)

I'm not sure if the added context helps, but when I try the same for different data it works fine, see inputs below:

posClinSig_Works<-structure(c(Benign = 2L, Pathogenic = 53L, `Uncertain Significance` = 106L
), dim = 3L, dimnames = list(. = c("Benign", "Pathogenic", "Uncertain Significance"
)), class = "table")
probVec_Works <- c(0.161348241247042, 0.625805925079572, 0.212845833673386)

I've tried using str() to check for differences in data format, but I don't see anything. I'm not sure if I'm missing something, or there's some underlying part of pairwise_chisq_test_against_p() that's being picky. Any help is appreciated!

0

There are 0 best solutions below