Description Usage Arguments Details Value Examples
Either Barnard, Fisher's, or Chi-sq test performed for unpaired data and McNemar's test for paired data
1 2 | two_samp_bin_test(x, y, method = NA, alternative = c("two.sided",
"less", "greater"), verbose = FALSE)
|
x |
vector with only 2 levels (can include NA values). |
y |
vector with only 2 levels (can include NA values unless |
method |
what test to run ("barnard", "fisher" ,"chi.sq" , "mcnemar"). No default so user must enter one of the four selections |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter. Only "two.sided" available for |
verbose |
a logical variable indicating if warnings and messages should be displayed. |
... |
parameters to pass to wilcox_test or t.test functions. For example the testing direction ( |
For one sided tests if y
is a factor variable the level order is respected, otherwise the levels will set to alphabetical order (i.e. if alternative = less
then testing a < b ).
If method = 'mcnemar'
assumes the first observations of the first group matches the first observation of the second group, and so on. Also if method = 'mcnemar'
then y
must have the same number of samples for each level.
p-value for comparing x at the different levels of y.
1 2 3 4 5 6 7 8 | set.seed(5432322)
x <- c(sample(0:1,10,replace = TRUE, prob = c(.75,.25)),
sample(0:1,10,replace = TRUE, prob = c(.25,.75)))
y <- c(rep('a', 10), rep('b', 10))
two_samp_bin_test(x,y, method = 'barnard')
two_samp_bin_test(x,y, 'fisher')
two_samp_bin_test(x,y, 'chi.sq')
two_samp_bin_test(x,y, 'mcnemar')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.