p_mcnemar.test {Spower} | R Documentation |
p-value from McNemar test simulation
Description
Generates two-dimensional sample data for McNemar test and
return a p-value. Uses mcnemar.test
.
Usage
p_mcnemar.test(
n,
prop,
two.tailed = TRUE,
correct = TRUE,
gen_fun = gen_mcnemar.test,
...
)
gen_mcnemar.test(n, prop, ...)
Arguments
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 |
Value
a single p-value
Author(s)
Phil Chalmers rphilip.chalmers@gmail.com
See Also
Examples
# 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))
[Package Spower version 0.2.3 Index]