#Nạp dữ liệu nghiên cứu
plot(x=thien1$mgbs,y=thien1$xhtp)
m = glm(thien1$xhtp ~ thien1$mgbs, family=binomial)
lines(thien1$mgbs, m$fitted.values)
library(pROC)
## Type 'citation("pROC")' for a citation.
##
## Attaching package: 'pROC'
## The following objects are masked from 'package:stats':
##
## cov, smooth, var
roc(thien1$xhtp, m$fitted.values, plot = TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$xhtp, predictor = m$fitted.values, plot = TRUE)
##
## Data: m$fitted.values in 123 controls (thien1$xhtp 0) < 7 cases (thien1$xhtp 1).
## Area under the curve: 0.687
roc(thien1$xhtp, m$fitted.values, plot = TRUE,legacy.axes=TRUE, percent=TRUE,
main = "Đường cong ROC của thang điểm mGBS về yêu cầu xuất huyết tái phát",
xlab="1-Độ đặc hiệu", ylab="Độ nhạy",
col="#377eb8",ldw=4, print.auc=TRUE,
auc.polygon=TRUE, max.auc.polygon=TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$xhtp, predictor = m$fitted.values, percent = TRUE, plot = TRUE, legacy.axes = TRUE, main = "Đường cong ROC của thang điểm mGBS về yêu cầu xuất huyết tái phát", xlab = "1-Độ đặc hiệu", ylab = "Độ nhạy", col = "#377eb8", ldw = 4, print.auc = TRUE, auc.polygon = TRUE, max.auc.polygon = TRUE)
##
## Data: m$fitted.values in 123 controls (thien1$xhtp 0) < 7 cases (thien1$xhtp 1).
## Area under the curve: 68.7%
plot(x=thien1$gbs, y=thien1$xhtp)
m1 = glm(thien1$xhtp ~ thien1$gbs, family=binomial)
lines(thien1$xhtp, m1$fitted.values)
roc(thien1$xhtp, m1$fitted.values, plot = TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$xhtp, predictor = m1$fitted.values, plot = TRUE)
##
## Data: m1$fitted.values in 123 controls (thien1$xhtp 0) < 7 cases (thien1$xhtp 1).
## Area under the curve: 0.6864
par(pty = "s")
roc(thien1$xhtp, m1$fitted.values, plot = TRUE,legacy.axes=TRUE, percent=TRUE,
main = "Đường cong ROC của thang điểm GBS về xuất huyết tái phát",
xlab="1-Độ đặc hiệu", ylab="Độ nhạy",
col="#7eb837",ldw=4, print.auc=TRUE,
auc.polygon=TRUE, max.auc.polygon=TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$xhtp, predictor = m1$fitted.values, percent = TRUE, plot = TRUE, legacy.axes = TRUE, main = "Đường cong ROC của thang điểm GBS về xuất huyết tái phát", xlab = "1-Độ đặc hiệu", ylab = "Độ nhạy", col = "#7eb837", ldw = 4, print.auc = TRUE, auc.polygon = TRUE, max.auc.polygon = TRUE)
##
## Data: m1$fitted.values in 123 controls (thien1$xhtp 0) < 7 cases (thien1$xhtp 1).
## Area under the curve: 68.64%
plot(x=thien1$crs, y=thien1$xhtp)
m2 = glm(thien1$xhtp ~ thien1$crs, family=binomial)
lines(thien1$crs, m2$fitted.values)
roc(thien1$xhtp, m2$fitted.values, plot = TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$xhtp, predictor = m2$fitted.values, plot = TRUE)
##
## Data: m2$fitted.values in 123 controls (thien1$xhtp 0) < 7 cases (thien1$xhtp 1).
## Area under the curve: 0.6069
roc(thien1$xhtp, m2$fitted.values, plot = TRUE,legacy.axes=TRUE, percent=TRUE,
main = "Đường cong ROC của thang điểm mGBS, GBS, cRS \n về xuất huyết tái phát",
xlab="1-Độ đặc hiệu", ylab="Độ nhạy",
col="#977dd8",ldw=4, print.auc=TRUE,
auc.polygon=TRUE, max.auc.polygon=TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$xhtp, predictor = m2$fitted.values, percent = TRUE, plot = TRUE, legacy.axes = TRUE, main = "Đường cong ROC của thang điểm mGBS, GBS, cRS \n về xuất huyết tái phát", xlab = "1-Độ đặc hiệu", ylab = "Độ nhạy", col = "#977dd8", ldw = 4, print.auc = TRUE, auc.polygon = TRUE, max.auc.polygon = TRUE)
##
## Data: m2$fitted.values in 123 controls (thien1$xhtp 0) < 7 cases (thien1$xhtp 1).
## Area under the curve: 60.69%
plot.roc(thien1$xhtp, m$fitted.values, percent=TRUE, col="#377eb8", print.auc=TRUE,
add=TRUE, print.auc.y=70)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
plot.roc(thien1$xhtp, m1$fitted.values, percent=TRUE, col="#7eb837", print.auc=TRUE,
add=TRUE, print.auc.y=60)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
legend("bottomright", legend=c("mGBS", "GBS", "cRS"),
col=c("#377eb8", "#7eb837","#977dd8"), lty=1:2, cex=0.8)
plot(x=thien1$mgbs,y=thien1$cammau)
m = glm(thien1$cammau ~ thien1$mgbs, family=binomial)
lines(thien1$mgbs, m$fitted.values)
library(pROC)
roc(thien1$cammau, m$fitted.values, plot = TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$cammau, predictor = m$fitted.values, plot = TRUE)
##
## Data: m$fitted.values in 93 controls (thien1$cammau 0) < 37 cases (thien1$cammau 1).
## Area under the curve: 0.6558
roc(thien1$cammau, m$fitted.values, plot = TRUE,legacy.axes=TRUE, percent=TRUE,
main = "Đường cong ROC của thang điểm mGBS về yêu cầu can thiệp cầm máu",
xlab="1-Độ đặc hiệu", ylab="Độ nhạy",
col="#377eb8",ldw=4, print.auc=TRUE,
auc.polygon=TRUE, max.auc.polygon=TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$cammau, predictor = m$fitted.values, percent = TRUE, plot = TRUE, legacy.axes = TRUE, main = "Đường cong ROC của thang điểm mGBS về yêu cầu can thiệp cầm máu", xlab = "1-Độ đặc hiệu", ylab = "Độ nhạy", col = "#377eb8", ldw = 4, print.auc = TRUE, auc.polygon = TRUE, max.auc.polygon = TRUE)
##
## Data: m$fitted.values in 93 controls (thien1$cammau 0) < 37 cases (thien1$cammau 1).
## Area under the curve: 65.58%
plot(x=thien1$gbs, y=thien1$cammau)
m1 = glm(thien1$cammau ~ thien1$gbs, family=binomial)
lines(thien1$cammau, m1$fitted.values)
library(pROC)
roc(thien1$cammau, m1$fitted.values, plot = TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$cammau, predictor = m1$fitted.values, plot = TRUE)
##
## Data: m1$fitted.values in 93 controls (thien1$cammau 0) < 37 cases (thien1$cammau 1).
## Area under the curve: 0.6328
par(pty = "s")
roc(thien1$cammau, m1$fitted.values, plot = TRUE,legacy.axes=TRUE, percent=TRUE,
main = "Đường cong ROC của thang điểm GBS về yêu cầu can thiệp cầm máu",
xlab="1-Độ đặc hiệu", ylab="Độ nhạy",
col="#7eb837",ldw=4, print.auc=TRUE,
auc.polygon=TRUE, max.auc.polygon=TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$cammau, predictor = m1$fitted.values, percent = TRUE, plot = TRUE, legacy.axes = TRUE, main = "Đường cong ROC của thang điểm GBS về yêu cầu can thiệp cầm máu", xlab = "1-Độ đặc hiệu", ylab = "Độ nhạy", col = "#7eb837", ldw = 4, print.auc = TRUE, auc.polygon = TRUE, max.auc.polygon = TRUE)
##
## Data: m1$fitted.values in 93 controls (thien1$cammau 0) < 37 cases (thien1$cammau 1).
## Area under the curve: 63.28%
plot(x=thien1$crs, y=thien1$cammau)
m2 = glm(thien1$cammau ~ thien1$crs, family=binomial)
lines(thien1$crs, m2$fitted.values)
library(pROC)
roc(thien1$cammau, m2$fitted.values, plot = TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$cammau, predictor = m2$fitted.values, plot = TRUE)
##
## Data: m2$fitted.values in 93 controls (thien1$cammau 0) < 37 cases (thien1$cammau 1).
## Area under the curve: 0.5926
roc(thien1$cammau, m2$fitted.values, plot = TRUE,legacy.axes=TRUE, percent=TRUE,
main = "Đường cong ROC của thang điểm mGBS, GBS, cRS \n về yêu cầu can thiệp cầm máu",
xlab="1-Độ đặc hiệu", ylab="Độ nhạy",
col="#977dd8",ldw=4, print.auc=TRUE,
auc.polygon=TRUE, max.auc.polygon=TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$cammau, predictor = m2$fitted.values, percent = TRUE, plot = TRUE, legacy.axes = TRUE, main = "Đường cong ROC của thang điểm mGBS, GBS, cRS \n về yêu cầu can thiệp cầm máu", xlab = "1-Độ đặc hiệu", ylab = "Độ nhạy", col = "#977dd8", ldw = 4, print.auc = TRUE, auc.polygon = TRUE, max.auc.polygon = TRUE)
##
## Data: m2$fitted.values in 93 controls (thien1$cammau 0) < 37 cases (thien1$cammau 1).
## Area under the curve: 59.26%
plot.roc(thien1$cammau, m$fitted.values, percent=TRUE, col="#377eb8", print.auc=TRUE,
add=TRUE, print.auc.x=80, print.auc.y=70)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
plot.roc(thien1$cammau, m1$fitted.values, percent=TRUE, col="#7eb837", print.auc=TRUE,
add=TRUE, print.auc.x=80, print.auc.y=60)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
legend("bottomright", legend=c("mGBS", "GBS", "cRS"),
col=c("#377eb8", "#7eb837","#977dd8"), lty=1:2, cex=0.8)
plot(x=thien1$mgbs,y=thien1$truyenmau)
m = glm(thien1$truyenmau ~ thien1$mgbs, family=binomial)
lines(thien1$mgbs, m$fitted.values)
library(pROC)
roc(thien1$truyenmau, m$fitted.values, plot = TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$truyenmau, predictor = m$fitted.values, plot = TRUE)
##
## Data: m$fitted.values in 71 controls (thien1$truyenmau 0) < 59 cases (thien1$truyenmau 1).
## Area under the curve: 0.8915
roc(thien1$truyenmau, m$fitted.values, plot = TRUE,legacy.axes=TRUE, percent=TRUE,
main = "Đường cong ROC của thang điểm mGBS về yêu cầu truyền máu",
xlab="1-Độ đặc hiệu", ylab="Độ nhạy",
col="#377eb8",ldw=4, print.auc=TRUE,
auc.polygon=TRUE, max.auc.polygon=TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$truyenmau, predictor = m$fitted.values, percent = TRUE, plot = TRUE, legacy.axes = TRUE, main = "Đường cong ROC của thang điểm mGBS về yêu cầu truyền máu", xlab = "1-Độ đặc hiệu", ylab = "Độ nhạy", col = "#377eb8", ldw = 4, print.auc = TRUE, auc.polygon = TRUE, max.auc.polygon = TRUE)
##
## Data: m$fitted.values in 71 controls (thien1$truyenmau 0) < 59 cases (thien1$truyenmau 1).
## Area under the curve: 89.15%
plot(x=thien1$gbs, y=thien1$truyenmau)
m1 = glm(thien1$truyenmau ~ thien1$gbs, family=binomial)
lines(thien1$truyenmau, m1$fitted.values)
library(pROC)
roc(thien1$truyenmau, m1$fitted.values, plot = TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$truyenmau, predictor = m1$fitted.values, plot = TRUE)
##
## Data: m1$fitted.values in 71 controls (thien1$truyenmau 0) < 59 cases (thien1$truyenmau 1).
## Area under the curve: 0.8867
par(pty = "s")
roc(thien1$ctyk, m1$fitted.values, plot = TRUE,legacy.axes=TRUE, percent=TRUE,
main = "Đường cong ROC của thang điểm GBS về yêu cầu truyền máu",
xlab="1-Độ đặc hiệu", ylab="Độ nhạy",
col="#7eb837",ldw=4, print.auc=TRUE,
auc.polygon=TRUE, max.auc.polygon=TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$ctyk, predictor = m1$fitted.values, percent = TRUE, plot = TRUE, legacy.axes = TRUE, main = "Đường cong ROC của thang điểm GBS về yêu cầu truyền máu", xlab = "1-Độ đặc hiệu", ylab = "Độ nhạy", col = "#7eb837", ldw = 4, print.auc = TRUE, auc.polygon = TRUE, max.auc.polygon = TRUE)
##
## Data: m1$fitted.values in 53 controls (thien1$ctyk 0) < 77 cases (thien1$ctyk 1).
## Area under the curve: 84.38%
plot(x=thien1$crs, y=thien1$truyenmau)
m2 = glm(thien1$truyenmau ~ thien1$crs, family=binomial)
lines(thien1$crs, m2$fitted.values)
library(pROC)
roc(thien1$truyenmau, m2$fitted.values, plot = TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$truyenmau, predictor = m2$fitted.values, plot = TRUE)
##
## Data: m2$fitted.values in 71 controls (thien1$truyenmau 0) < 59 cases (thien1$truyenmau 1).
## Area under the curve: 0.739
roc(thien1$truyenmau, m2$fitted.values, plot = TRUE,legacy.axes=TRUE, percent=TRUE,
main = "Đường cong ROC của thang điểm mGBS, GBS, cRS \n về yêu cầu truyền máu",
xlab="1-Độ đặc hiệu", ylab="Độ nhạy",
col="#977dd8",ldw=4, print.auc=TRUE,
auc.polygon=TRUE, max.auc.polygon=TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$truyenmau, predictor = m2$fitted.values, percent = TRUE, plot = TRUE, legacy.axes = TRUE, main = "Đường cong ROC của thang điểm mGBS, GBS, cRS \n về yêu cầu truyền máu", xlab = "1-Độ đặc hiệu", ylab = "Độ nhạy", col = "#977dd8", ldw = 4, print.auc = TRUE, auc.polygon = TRUE, max.auc.polygon = TRUE)
##
## Data: m2$fitted.values in 71 controls (thien1$truyenmau 0) < 59 cases (thien1$truyenmau 1).
## Area under the curve: 73.9%
plot.roc(thien1$truyenmau, m$fitted.values, percent=TRUE, col="#377eb8", print.auc=TRUE,
add=TRUE, print.auc.y=70)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
plot.roc(thien1$truyenmau, m1$fitted.values, percent=TRUE, col="#7eb837", print.auc=TRUE,
add=TRUE, print.auc.y=60)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
legend("bottomright", legend=c("mGBS", "GBS", "cRS"),
col=c("#377eb8", "#7eb837","#977dd8"), lty=1:2, cex=0.8)
plot(x=thien1$mgbs,y=thien1$ctyk)
m = glm(thien1$ctyk ~ thien1$mgbs, family=binomial)
lines(thien1$mgbs, m$fitted.values)
library(pROC)
roc(thien1$ctyk, m$fitted.values, plot = TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$ctyk, predictor = m$fitted.values, plot = TRUE)
##
## Data: m$fitted.values in 53 controls (thien1$ctyk 0) < 77 cases (thien1$ctyk 1).
## Area under the curve: 0.8445
roc(thien1$ctyk, m$fitted.values, plot = TRUE,legacy.axes=TRUE, percent=TRUE,
main = "Đường cong ROC của thang điểm mGBS về yêu cầu can thiệp y khoa",
xlab="1-Độ đặc hiệu", ylab="Độ nhạy",
col="#377eb8",ldw=4, print.auc=TRUE,
auc.polygon=TRUE, max.auc.polygon=TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$ctyk, predictor = m$fitted.values, percent = TRUE, plot = TRUE, legacy.axes = TRUE, main = "Đường cong ROC của thang điểm mGBS về yêu cầu can thiệp y khoa", xlab = "1-Độ đặc hiệu", ylab = "Độ nhạy", col = "#377eb8", ldw = 4, print.auc = TRUE, auc.polygon = TRUE, max.auc.polygon = TRUE)
##
## Data: m$fitted.values in 53 controls (thien1$ctyk 0) < 77 cases (thien1$ctyk 1).
## Area under the curve: 84.45%
plot(x=thien1$gbs, y=thien1$ctyk)
m1 = glm(thien1$ctyk ~ thien1$gbs, family=binomial)
lines(thien1$ctyk, m1$fitted.values)
library(pROC)
roc(thien1$ctyk, m1$fitted.values, plot = TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$ctyk, predictor = m1$fitted.values, plot = TRUE)
##
## Data: m1$fitted.values in 53 controls (thien1$ctyk 0) < 77 cases (thien1$ctyk 1).
## Area under the curve: 0.8438
par(pty = "s")
roc(thien1$ctyk, m1$fitted.values, plot = TRUE,legacy.axes=TRUE, percent=TRUE,
main = "Đường cong ROC của thang điểm GBS về yêu cầu can thiệp y khoa",
xlab="1-Độ đặc hiệu", ylab="Độ nhạy",
col="#7eb837",ldw=4, print.auc=TRUE,
auc.polygon=TRUE, max.auc.polygon=TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$ctyk, predictor = m1$fitted.values, percent = TRUE, plot = TRUE, legacy.axes = TRUE, main = "Đường cong ROC của thang điểm GBS về yêu cầu can thiệp y khoa", xlab = "1-Độ đặc hiệu", ylab = "Độ nhạy", col = "#7eb837", ldw = 4, print.auc = TRUE, auc.polygon = TRUE, max.auc.polygon = TRUE)
##
## Data: m1$fitted.values in 53 controls (thien1$ctyk 0) < 77 cases (thien1$ctyk 1).
## Area under the curve: 84.38%
plot(x=thien1$crs, y=thien1$ctyk)
m2 = glm(thien1$ctyk ~ thien1$crs, family=binomial)
lines(thien1$crs, m2$fitted.values)
library(pROC)
roc(thien1$ctyk, m2$fitted.values, plot = TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$ctyk, predictor = m2$fitted.values, plot = TRUE)
##
## Data: m2$fitted.values in 53 controls (thien1$ctyk 0) < 77 cases (thien1$ctyk 1).
## Area under the curve: 0.7071
roc(thien1$ctyk, m2$fitted.values, plot = TRUE,legacy.axes=TRUE, percent=TRUE,
main = "Đường cong ROC của thang điểm mGBS, GBS, cRS \n về yêu cầu can thiệp y khoa",
xlab="1-Độ đặc hiệu", ylab="Độ nhạy",
col="#977dd8",ldw=4, print.auc=TRUE,
auc.polygon=TRUE, max.auc.polygon=TRUE)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##
## Call:
## roc.default(response = thien1$ctyk, predictor = m2$fitted.values, percent = TRUE, plot = TRUE, legacy.axes = TRUE, main = "Đường cong ROC của thang điểm mGBS, GBS, cRS \n về yêu cầu can thiệp y khoa", xlab = "1-Độ đặc hiệu", ylab = "Độ nhạy", col = "#977dd8", ldw = 4, print.auc = TRUE, auc.polygon = TRUE, max.auc.polygon = TRUE)
##
## Data: m2$fitted.values in 53 controls (thien1$ctyk 0) < 77 cases (thien1$ctyk 1).
## Area under the curve: 70.71%
plot.roc(thien1$ctyk, m$fitted.values, percent=TRUE, col="#377eb8", print.auc=TRUE,
add=TRUE, print.auc.y=70)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
plot.roc(thien1$ctyk, m1$fitted.values, percent=TRUE, col="#7eb837", print.auc=TRUE,
add=TRUE, print.auc.y=60)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
legend("bottomright", legend=c("mGBS", "GBS", "cRS"),
col=c("#377eb8", "#7eb837","#977dd8"), lty=1:2, cex=0.8)
roc1 <- roc(thien1$truyenmau, thien1$mgbs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
roc2 <- roc(thien1$truyenmau, thien1$gbs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
roc3 <- roc(thien1$truyenmau, thien1$crs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
auc(roc1)
## Area under the curve: 0.8915
auc(roc2)
## Area under the curve: 0.8867
auc(roc3)
## Area under the curve: 0.739
test1 <- roc.test(roc1, roc2)
test2 <- roc.test(roc1, roc3)
test3 <- roc.test(roc2, roc3)
print(test1)
##
## DeLong's test for two correlated ROC curves
##
## data: roc1 and roc2
## Z = 0.44722, p-value = 0.6547
## alternative hypothesis: true difference in AUC is not equal to 0
## 95 percent confidence interval:
## -0.01614978 0.02569859
## sample estimates:
## AUC of roc1 AUC of roc2
## 0.8915016 0.8867271
print(test2)
##
## DeLong's test for two correlated ROC curves
##
## data: roc1 and roc3
## Z = 3.2654, p-value = 0.001093
## alternative hypothesis: true difference in AUC is not equal to 0
## 95 percent confidence interval:
## 0.06098259 0.24410215
## sample estimates:
## AUC of roc1 AUC of roc2
## 0.8915016 0.7389592
print(test3)
##
## DeLong's test for two correlated ROC curves
##
## data: roc2 and roc3
## Z = 3.4519, p-value = 0.0005566
## alternative hypothesis: true difference in AUC is not equal to 0
## 95 percent confidence interval:
## 0.06386728 0.23166865
## sample estimates:
## AUC of roc1 AUC of roc2
## 0.8867271 0.7389592
p_values <- c(test1$p.value, test2$p.value, test3$p.value)
p_adjusted <- p.adjust(p_values, method = "bonferroni")
print(p_adjusted)
## [1] 1.000000000 0.003279510 0.001669732
roc1 <- roc(thien1$cammau, thien1$mgbs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
roc2 <- roc(thien1$cammau, thien1$gbs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
roc3 <- roc(thien1$cammau, thien1$crs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
auc(roc1)
## Area under the curve: 0.6558
auc(roc2)
## Area under the curve: 0.6328
auc(roc3)
## Area under the curve: 0.5926
test1 <- roc.test(roc1, roc2)
test2 <- roc.test(roc1, roc3)
test3 <- roc.test(roc2, roc3)
print(test1)
##
## DeLong's test for two correlated ROC curves
##
## data: roc1 and roc2
## Z = 1.8076, p-value = 0.07067
## alternative hypothesis: true difference in AUC is not equal to 0
## 95 percent confidence interval:
## -0.001935493 0.047852378
## sample estimates:
## AUC of roc1 AUC of roc2
## 0.6557687 0.6328102
print(test2)
##
## DeLong's test for two correlated ROC curves
##
## data: roc1 and roc3
## Z = 1.0001, p-value = 0.3173
## alternative hypothesis: true difference in AUC is not equal to 0
## 95 percent confidence interval:
## -0.0606652 0.1870819
## sample estimates:
## AUC of roc1 AUC of roc2
## 0.6557687 0.5925603
print(test3)
##
## DeLong's test for two correlated ROC curves
##
## data: roc2 and roc3
## Z = 0.68058, p-value = 0.4961
## alternative hypothesis: true difference in AUC is not equal to 0
## 95 percent confidence interval:
## -0.07566367 0.15616353
## sample estimates:
## AUC of roc1 AUC of roc2
## 0.6328102 0.5925603
p_values <- c(test1$p.value, test2$p.value, test3$p.value)
p_adjusted <- p.adjust(p_values, method = "bonferroni")
print(p_adjusted)
## [1] 0.2120168 0.9517844 1.0000000
roc1 <- roc(thien1$ctyk, thien1$mgbs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
roc2 <- roc(thien1$ctyk, thien1$gbs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
roc3 <- roc(thien1$ctyk, thien1$crs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
auc(roc1)
## Area under the curve: 0.8445
auc(roc2)
## Area under the curve: 0.8438
auc(roc3)
## Area under the curve: 0.7071
test1 <- roc.test(roc1, roc2)
test2 <- roc.test(roc1, roc3)
test3 <- roc.test(roc2, roc3)
print(test1)
##
## DeLong's test for two correlated ROC curves
##
## data: roc1 and roc2
## Z = 0.073471, p-value = 0.9414
## alternative hypothesis: true difference in AUC is not equal to 0
## 95 percent confidence interval:
## -0.01887527 0.02034549
## sample estimates:
## AUC of roc1 AUC of roc2
## 0.8445234 0.8437883
print(test2)
##
## DeLong's test for two correlated ROC curves
##
## data: roc1 and roc3
## Z = 2.7242, p-value = 0.006445
## alternative hypothesis: true difference in AUC is not equal to 0
## 95 percent confidence interval:
## 0.03856568 0.23636694
## sample estimates:
## AUC of roc1 AUC of roc2
## 0.8445234 0.7070571
print(test3)
##
## DeLong's test for two correlated ROC curves
##
## data: roc2 and roc3
## Z = 2.9256, p-value = 0.003438
## alternative hypothesis: true difference in AUC is not equal to 0
## 95 percent confidence interval:
## 0.0451311 0.2283313
## sample estimates:
## AUC of roc1 AUC of roc2
## 0.8437883 0.7070571
p_values <- c(test1$p.value, test2$p.value, test3$p.value)
p_adjusted <- p.adjust(p_values, method = "bonferroni")
print(p_adjusted)
## [1] 1.00000000 0.01933492 0.01031270
roc_curve <- roc(thien1$truyenmau, thien1$mgbs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
optimal_cutoff_mgbs1 <- coords(roc_curve, "best", ret = "threshold",
best.method = "youden")
optimal_coords_mgbs1 <- coords(roc_curve, "best", ret = c("threshold", "sensitivity", "specificity", "accuracy",
"npv", "ppv"))
print(optimal_coords_mgbs1)
## threshold sensitivity specificity accuracy npv ppv
## threshold 7.5 0.8983051 0.7323944 0.8076923 0.8965517 0.7361111
roc_curve <- roc(thien1$cammau, thien1$mgbs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
optimal_cutoff_mgbs2 <- coords(roc_curve, "best", ret = "threshold",
best.method = "youden")
optimal_coords_mgbs2 <- coords(roc_curve, "best", ret = c("threshold", "sensitivity", "specificity", "accuracy",
"npv", "ppv"))
print(optimal_coords_mgbs2)
## threshold sensitivity specificity accuracy npv ppv
## threshold 7.5 0.7297297 0.516129 0.5769231 0.8275862 0.375
roc_curve <- roc(thien1$ctyk, thien1$mgbs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
optimal_cutoff_mgbs <- coords(roc_curve, "best", ret = "threshold",
best.method = "youden")
optimal_coords_mgbs <- coords(roc_curve, "best", ret = c("threshold", "sensitivity", "specificity", "accuracy",
"npv", "ppv"))
print(optimal_coords_mgbs)
## threshold sensitivity specificity accuracy npv ppv
## threshold 7.5 0.7792208 0.7735849 0.7769231 0.7068966 0.8333333
roc_curve <- roc(thien1$truyenmau, thien1$gbs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
optimal_cutoff_gbs1 <- coords(roc_curve, "best", ret = "threshold",
best.method = "youden")
optimal_coords_gbs1 <- coords(roc_curve, "best", ret = c("threshold", "sensitivity", "specificity", "accuracy",
"npv", "ppv"))
print(optimal_coords_gbs1)
## threshold sensitivity specificity accuracy npv ppv
## threshold 8.5 0.8983051 0.6901408 0.7846154 0.8909091 0.7066667
roc_curve <- roc(thien1$cammau, thien1$gbs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
optimal_cutoff_gbs2 <- coords(roc_curve, "best", ret = "threshold",
best.method = "youden")
optimal_coords_gbs2 <- coords(roc_curve, "best", ret = c("threshold", "sensitivity", "specificity", "accuracy",
"npv", "ppv"))
print(optimal_coords_gbs2)
## threshold sensitivity specificity accuracy npv ppv
## threshold 7.5 0.8378378 0.3870968 0.5153846 0.8571429 0.3522727
roc_curve <- roc(thien1$ctyk, thien1$gbs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
optimal_cutoff_gbs <- coords(roc_curve, "best", ret = "threshold",
best.method = "youden")
optimal_coords_gbs <- coords(roc_curve, "best", ret = c("threshold", "sensitivity", "specificity", "accuracy",
"npv", "ppv"))
print(optimal_coords_gbs)
## threshold sensitivity specificity accuracy npv ppv
## threshold 8.5 0.8051948 0.754717 0.7846154 0.7272727 0.8266667
roc_curve <- roc(thien1$truyenmau, thien1$crs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
optimal_cutoff_crs1 <- coords(roc_curve, "best", ret = "threshold",
best.method = "youden")
optimal_coords_crs1 <- coords(roc_curve, "best", ret = c("threshold", "sensitivity", "specificity", "accuracy",
"npv", "ppv"))
print(optimal_coords_crs1)
## threshold sensitivity specificity accuracy npv ppv
## threshold 1.5 0.779661 0.5915493 0.6769231 0.7636364 0.6133333
roc_curve <- roc(thien1$cammau, thien1$crs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
optimal_cutoff_crs2 <- coords(roc_curve, "best", ret = "threshold",
best.method = "youden")
optimal_coords_crs2 <- coords(roc_curve, "best", ret = c("threshold", "sensitivity", "specificity", "accuracy",
"npv", "ppv"))
print(optimal_coords_crs2)
## threshold sensitivity specificity accuracy npv ppv
## threshold 4.5 0.2432432 0.9139785 0.7230769 0.7522124 0.5294118
roc_curve <- roc(thien1$cammau, thien1$mgbs)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
optimal_cutoff_mgbs2 <- coords(roc_curve, "best", ret = "threshold",
best.method = "youden")
optimal_coords_mgbs2 <- coords(roc_curve, "best", ret = c("threshold", "sensitivity", "specificity", "accuracy",
"npv", "ppv"))
print(optimal_coords_mgbs2)
## threshold sensitivity specificity accuracy npv ppv
## threshold 7.5 0.7297297 0.516129 0.5769231 0.8275862 0.375