Hi there, I am developing some in-class exercises for my MPH epidemiology students. I am having them work in R, but I always like to provide Stata equivalents where possible. We are working on estimating sensitivity and specificity values this week. We're using published aggregate estimates to calculate sensitivity and specificity values in R and Stata; I'm using the epiR package to do this in R. I thought the best command to do this in Stata was diagti; however, the results differ from what I get in R even though the 2 x 2 table are the same. Note, the R output aligns with the published Se + Sp estimates. Am I missing something?
Here are the results from diagti:
. diagti 552 308 249 303 /*TP,FP,FN,TN*/
True |
disease | Test result
status | Pos. Neg. | Total
-----------+----------------------+----------
Abnormal | 552 308 | 860
Normal | 249 303 | 552
-----------+----------------------+----------
Total | 801 611 | 1,412
-------------------------------------------------------------------------
Sensitivity Pr( +| D) 64.19% 60.88% 67.40%
Specificity Pr( -|~D) 54.89% 50.63% 59.10%
Positive predictive value Pr( D| +) 68.91% 65.58% 72.11%
Negative predictive value Pr(~D| -) 49.59% 45.55% 53.63%
-------------------------------------------------------------------------
Prevalence Pr(D) 60.91% 58.31% 63.46%
-------------------------------------------------------------------------
And the results from using epi.tests() in R:
Outcome + Outcome - Total
Test + 552 308 860
Test - 249 303 552
Total 801 611 1412
Point estimates and 95 % CIs:
---------------------------------------------------------
Apparent prevalence 0.61 (0.58, 0.63)
True prevalence 0.57 (0.54, 0.59)
Sensitivity 0.69 (0.66, 0.72)
Specificity 0.50 (0.46, 0.54)
Positive predictive value 0.64 (0.61, 0.67)
Negative predictive value 0.55 (0.51, 0.59)
Positive likelihood ratio 1.37 (1.25, 1.50)
Negative likelihood ratio 0.63 (0.55, 0.71)
---------------------------------------------------------
Thank you in advance for your help.
Here are the results from diagti:
. diagti 552 308 249 303 /*TP,FP,FN,TN*/
True |
disease | Test result
status | Pos. Neg. | Total
-----------+----------------------+----------
Abnormal | 552 308 | 860
Normal | 249 303 | 552
-----------+----------------------+----------
Total | 801 611 | 1,412
-------------------------------------------------------------------------
Sensitivity Pr( +| D) 64.19% 60.88% 67.40%
Specificity Pr( -|~D) 54.89% 50.63% 59.10%
Positive predictive value Pr( D| +) 68.91% 65.58% 72.11%
Negative predictive value Pr(~D| -) 49.59% 45.55% 53.63%
-------------------------------------------------------------------------
Prevalence Pr(D) 60.91% 58.31% 63.46%
-------------------------------------------------------------------------
And the results from using epi.tests() in R:
Outcome + Outcome - Total
Test + 552 308 860
Test - 249 303 552
Total 801 611 1412
Point estimates and 95 % CIs:
---------------------------------------------------------
Apparent prevalence 0.61 (0.58, 0.63)
True prevalence 0.57 (0.54, 0.59)
Sensitivity 0.69 (0.66, 0.72)
Specificity 0.50 (0.46, 0.54)
Positive predictive value 0.64 (0.61, 0.67)
Negative predictive value 0.55 (0.51, 0.59)
Positive likelihood ratio 1.37 (1.25, 1.50)
Negative likelihood ratio 0.63 (0.55, 0.71)
---------------------------------------------------------
Thank you in advance for your help.
Comment