1 筛查试验

评价筛查/诊断试验一般考虑真实性、可靠性等指标。常见的是灵敏度、特异度、一致率等指标。

2 {epiR}

该包集合了流行病学中诸多描述性分析的函数。其中epi.tests函数专门用于计算诊断试验的灵敏度、特异度及预测值等指标。

3 操作

以流行病学第8版P107表8-3血清肌酸肌激酶测定诊断急性心肌梗死数据为例。

3.1 生成数据

heart <- as.table(matrix(c(225, 24, 25, 121), nrow = 2, byrow = TRUE))
colnames(heart) <- c("急性心肌梗死","非急性心肌梗死")
rownames(heart) <- c("血清肌酸激酶+","血清肌酸激酶-")
heart
##               急性心肌梗死 非急性心肌梗死
## 血清肌酸激酶+          225             24
## 血清肌酸激酶-           25            121

3.2 建立指标名称集

index <-  c("apparent prevalence", "true prevalence", "test sensitivity", "test specificity", "diagnostic accuracy", "diagnostic odds ratio", "number needed to diagnose", "Youden's index", "positive predictive value", "negative predictive value", "likelihood ratio of a positive test", "likelihood ratio of a negative test", "the proportion of subjects with the outcome ruled out", "the proportion of subjects with the outcome ruled in", "the proportion of false positives", "the proportion of false negative")

index_c <- c("筛查患病率", "金标患病率", "灵敏度", "特异度", "符合率", "诊断率比", "阳性检出基数", "约登指数", "阳性预测值", "阴性预测值", "阳性似然比", "阴性似然比", "筛出率", "筛入率", "假阳性率", "假阴性率")

3.3 指标计算

library(epiR)
library(tidyverse)
test <- epi.tests(heart, conf.level = .95) 
test
##           Outcome +    Outcome -      Total
## Test +          225           24        249
## Test -           25          121        146
## Total           250          145        395
## 
## Point estimates and 95 % CIs:
## ---------------------------------------------------------
## Apparent prevalence                    0.63 (0.58, 0.68)
## True prevalence                        0.63 (0.58, 0.68)
## Sensitivity                            0.90 (0.86, 0.93)
## Specificity                            0.83 (0.76, 0.89)
## Positive predictive value              0.90 (0.86, 0.94)
## Negative predictive value              0.83 (0.76, 0.89)
## Positive likelihood ratio              5.44 (3.76, 7.85)
## Negative likelihood ratio              0.12 (0.08, 0.18)
## ---------------------------------------------------------
# 生成tidy结果数据集
test1 <- test %>% 
  summary() %>%
  #结果数据集行名加为变量
  rownames_to_column() %>%
  #增加结果名称及中文说明
  mutate(index = index, index_c = index_c)
test1
rowname est lower upper index index_c
aprev 0.6303797 0.5806758 0.6781139 apparent prevalence 筛查患病率
tprev 0.6329114 0.5832560 0.6805587 true prevalence 金标患病率
se 0.9000000 0.8559246 0.9342340 test sensitivity 灵敏度
sp 0.8344828 0.7638077 0.8909771 test specificity 特异度
diag.acc 0.8759494 0.8393324 0.9068004 diagnostic accuracy 符合率
diag.or 45.3750000 24.8497687 82.8535126 diagnostic odds ratio 诊断率比
nnd 1.3615023 1.2118111 1.6135999 number needed to diagnose 阳性检出基数
youden 0.7344828 0.6197323 0.8252111 Youden’s index 约登指数
ppv 0.9036145 0.8599841 0.9372635 positive predictive value 阳性预测值
npv 0.8287671 0.7576903 0.8860151 negative predictive value 阴性预测值
plr 5.4375000 3.7641479 7.8547408 likelihood ratio of a positive test 阳性似然比
nlr 0.1198347 0.0820425 0.1750357 likelihood ratio of a negative test 阴性似然比
pro 0.3696203 0.3218861 0.4193242 the proportion of subjects with the outcome ruled out 筛出率
pri 0.6303797 0.5806758 0.6781139 the proportion of subjects with the outcome ruled in 筛入率
pfp 0.1655172 0.1090229 0.2361923 the proportion of false positives 假阳性率
pfn 0.1000000 0.0657660 0.1440754 the proportion of false negative 假阴性率
# 整理结果
test1 <- test1 %>%
 filter(rowname %in% c("se", "sp", "pfp", "pfn", "youden")) %>%  
 mutate(across(where(is.double), ~ scales::percent(.x, accuracy = 0.01)))%>% 
 mutate(res = paste0(index_c, "为", est, "(95%CI ", lower, " - ", upper, ")")) 
# nnd
nnd <- test1 %>% 
    filter(rowname == "nnd") %>% 
    mutate(across(where(is.double), ~round(.x, 2))) %>%
    mutate(res = paste0(index_c, "为", est, "(95%CI ", lower, " - ", upper, ")")) %>% 
    pull(res)

3.4 结果解释

本诊断实验的灵敏度为90.00%(95%CI 85.59% - 93.42%), 特异度为83.45%(95%CI 76.38% - 89.10%), 约登指数为73.45%(95%CI 61.97% - 82.52%), 假阳性率为16.55%(95%CI 10.90% - 23.62%), 假阴性率为10.00%(95%CI 6.58% - 14.41%)。其中“nnd-number needed to diagnose”即,此指标意味着大约要对136个人进行检测才有可能发现100个阳性结果。