View source: R/p_mcnemar.test.R
p_mcnemar.test | R Documentation |
Generates two-dimensional sample data for McNemar test and
return a p-value. Uses mcnemar.test
.
p_mcnemar.test(
n,
prop,
two.tailed = TRUE,
correct = TRUE,
gen_fun = gen_mcnemar.test,
...
)
gen_mcnemar.test(n, prop, ...)
n |
total sample size |
prop |
two-dimensional matrix of proportions/probabilities |
two.tailed |
logical; should a two-tailed or one-tailed test be used? |
correct |
logical; use continuity correction? Only applicable for 2x2 tables |
gen_fun |
function used to generate the required discrete data.
Object returned must be a |
... |
additional arguments to be passed to |
a single p-value
Phil Chalmers rphilip.chalmers@gmail.com
gen_mcnemar.test
# from ?mcnemar.test
Performance <- matrix(c(794, 86, 150, 570),
nrow = 2,
dimnames = list("1st Survey" = c("Approve", "Disapprove"),
"2nd Survey" = c("Approve", "Disapprove")))
(prop <- prop.table(Performance))
# one sample + test and resulting p-value
p_mcnemar.test(n=sum(Performance), prop=prop)
# post-hoc power (not recommended)
Spower(p_mcnemar.test(n=sum(Performance), prop=prop))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.