Last data update: 2014.03.03

R: McNemar Test for Comparison of Sensitivities and...
sesp.mcnemarR Documentation

McNemar Test for Comparison of Sensitivities and Specificities

Description

Performs a McNemar Test for comparison of sensitivities and specificities of two binary diagnostic tests in a paired study design.

Usage

sesp.mcnemar(tab)

Arguments

tab

An object of class tab.paired.

Details

The test is performed as described by McNemar (1947).

Value

A list containing:

sensitivity

A list containing test1 (sensitivity of test 1), test2 (specificity of test 2), diff (the difference in sensitivity, computed as test2 - test1), the test.statistic and the corresponding p.value.

specificity

A list containing test1 (specificity of test 1), test2 (specificity of test 2), diff (the difference in specificity, computed as test2 - test1), the test.statistic and the corresponding p.value.

method

The name of the method used to compare sensitivity and specificity, here “mcnemar”.

References

McNemar, Q. (1947). Note on the sampling error of the difference between correlated proportions or percentages. Psychometrika, 12(2):153-7.

See Also

sesp.exactbinom and tab.paired.

Examples

data(Paired1) # Hypothetical study data
ftable(Paired1)
paired.layout <- tab.paired(d=d, y1=y1, y2=y2, data=Paired1)
paired.layout 
mcnem.results <- sesp.mcnemar(paired.layout)
str(mcnem.results)
mcnem.results
mcnem.results$sensitivity["p.value"]

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(DTComPair)
Loading required package: gee
Loading required package: PropCIs
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DTComPair/sesp.mcnemar.Rd_%03d_medium.png", width=480, height=480)
> ### Name: sesp.mcnemar
> ### Title: McNemar Test for Comparison of Sensitivities and Specificities
> ### Aliases: sesp.mcnemar
> 
> ### ** Examples
> 
> data(Paired1) # Hypothetical study data
> ftable(Paired1)
     y2   0   1
d y1           
0 0     155  22
  1      53  31
1 0      32  22
  1      78 319
> paired.layout <- tab.paired(d=d, y1=y1, y2=y2, data=Paired1)
> paired.layout 
Two binary diagnostic tests (paired design)

Test1: 'y1'
Test2: 'y2'

Diseased:
           Test1 pos. Test1 neg. Total
Test2 pos.        319         22   341
Test2 neg.         78         32   110
Total             397         54   451

Non-diseased:
           Test1 pos. Test1 neg. Total
Test2 pos.         31         22    53
Test2 neg.         53        155   208
Total              84        177   261

> mcnem.results <- sesp.mcnemar(paired.layout)
> str(mcnem.results)
List of 3
 $ sensitivity:List of 5
  ..$ test1         : num 0.88
  ..$ test2         : num 0.756
  ..$ diff          : num -0.124
  ..$ test.statistic: num 31.4
  ..$ p.value       : num 2.14e-08
 $ specificity:List of 5
  ..$ test1         : num 0.678
  ..$ test2         : num 0.797
  ..$ diff          : num 0.119
  ..$ test.statistic: num 12.8
  ..$ p.value       : num 0.000344
 $ method     : chr "mcnemar"
> mcnem.results
$sensitivity
$sensitivity$test1
[1] 0.8802661

$sensitivity$test2
[1] 0.7560976

$sensitivity$diff
[1] -0.1241685

$sensitivity$test.statistic
[1] 31.36

$sensitivity$p.value
[1] 2.143518e-08


$specificity
$specificity$test1
[1] 0.6781609

$specificity$test2
[1] 0.7969349

$specificity$diff
[1] 0.1187739

$specificity$test.statistic
[1] 12.81333

$specificity$p.value
[1] 0.0003441579


$method
[1] "mcnemar"

> mcnem.results$sensitivity["p.value"]
$p.value
[1] 2.143518e-08

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>