infer_mcnemar_test: McNemar Test

Description Usage Arguments Value Deprecated Function References See Also Examples

View source: R/ifr-mcnemar-test.R

Description

Test if the proportions of two dichotomous variables are equal in the same population.

Usage

1

Arguments

data

a data.frame or tibble

x

factor; column in data

y

factor; column in data

Value

infer_mcnemar_test returns an object of class "infer_mcnemar_test". An object of class "infer_mcnemar_test" is a list containing the following components:

statistic

chi square statistic

df

degrees of freedom

pvalue

p-value

exactp

exact p-value

cstat

continuity correction chi square statistic

cpvalue

continuity correction p-value

kappa

kappa coefficient; measure of interrater agreement

std_err

asymptotic standard error

kappa_cil

95% kappa lower confidence limit

kappa_ciu

95% kappa upper confidence limit

cases

cases

controls

controls

ratio

ratio of proportion with factor

odratio

odds ratio

tbl

two way table

Deprecated Function

mcnermar_test() has been deprecated. Instead use infer_mcnemar_test().

References

Sheskin, D. J. 2007. Handbook of Parametric and Nonparametric Statistical Procedures, 4th edition. : Chapman & Hall/CRC.

See Also

mcnemar.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# using variables from data
hb <- hsb
hb$himath <- ifelse(hsb$math > 60, 1, 0)
hb$hiread <- ifelse(hsb$read > 60, 1, 0)
infer_mcnemar_test(hb, himath, hiread)

# test if the proportion of students in himath and hiread group is same
himath <- ifelse(hsb$math > 60, 1, 0)
hiread <- ifelse(hsb$read > 60, 1, 0)
infer_mcnemar_test(table(himath, hiread))

# using matrix
infer_mcnemar_test(matrix(c(135, 18, 21, 26), nrow = 2))

inferr documentation built on May 29, 2021, 1:07 a.m.