library(DescTools)
library(ggpubr)
## Loading required package: ggplot2
## Loading required package: magrittr
library(rcompanion)
library(gridExtra)
options(scipen = 999)
t = "C:\\Users\\Admin\\Google Drive\\HOC TAP\\NCKH\\Data ung thu\\Viet bai\\R code\\Xu ly du lieu lan 2\\lieu_folfox2.csv"
duy = read.csv(t)
duy1 = subset(duy, hoachat != "5-FU")
attach(duy)
head(duy)
## bv phacdo hoachat lieu drp drp_lieu
## 1 TB FOLFOX4 5-FU bolus 96.77419 Khong Khong
## 2 TB FOLFOX4 5-FU bolus 96.77419 Khong Khong
## 3 TB FOLFOX4 5-FU bolus 96.77419 Khong Khong
## 4 TB FOLFOX4 5-FU bolus 96.77419 Khong Khong
## 5 TB FOLFOX4 5-FU bolus 96.77419 Khong Khong
## 6 TB FOLFOX4 5-FU bolus 96.77419 Khong Khong
Thống kê hóa chất theo phác đồ
Desc(phacdo ~ hoachat, data = duy1)
## ------------------------------------------------------------------------------
## phacdo ~ hoachat
##
##
## Summary:
## n: 3'870, rows: 2, columns: 4
##
## Pearson's Chi-squared test:
## X-squared = 59.282, df = 3, p-value = 0.0000000000008366
## Likelihood Ratio:
## X-squared = 55.49, df = 3, p-value = 0.000000000005397
## Mantel-Haenszel Chi-squared:
## X-squared = 29.907, df = 1, p-value = 0.00000004533
##
## Phi-Coefficient 0.124
## Contingency Coeff. 0.123
## Cramer's V 0.124
##
##
## hoachat 5-FU bolus 5-FU iv leucovorin oxaliplatin Sum
## phacdo
##
## FOLFOX4 freq 828 828 828 414 2'898
## perc 21.4% 21.4% 21.4% 10.7% 74.9%
## p.row 28.6% 28.6% 28.6% 14.3% .
## p.col 77.3% 77.3% 77.3% 63.0% .
##
## mFOLFOX6 freq 243 243 243 243 972
## perc 6.3% 6.3% 6.3% 6.3% 25.1%
## p.row 25.0% 25.0% 25.0% 25.0% .
## p.col 22.7% 22.7% 22.7% 37.0% .
##
## Sum freq 1'071 1'071 1'071 657 3'870
## perc 27.7% 27.7% 27.7% 17.0% 100.0%
## p.row . . . . .
## p.col . . . . .
##
Biểu đồ tích lũy của các hóa chất
p1 = ggplot(duy1, aes(lieu, colour = hoachat)) + scale_x_continuous(name = "Relative dose (%)", breaks = seq(60,140,10)) + scale_y_continuous(name = "Cumulative percentage of prescriptions", breaks = seq(0,1,0.2)) + stat_ecdf() + theme(legend.position="top") + theme(legend.position="top") + geom_vline(xintercept=c(85,90,110,115), linetype="dashed", color = "purple", size=1.2)
p1
#5-FU là tổng liều 5-FU bolus và 5-FU iv
fu = subset(duy, hoachat == "5-FU")
fu_bolus = subset(duy, hoachat == "5-FU bolus")
fu_iv = subset(duy, hoachat == "5-FU iv")
leuco = subset(duy, hoachat == "leucovorin")
oxa = subset(duy, hoachat == "oxaliplatin")
Thống kê cho 5-FU bolus
#Biểu đồ tích lũy 5-FU bolus
p2 = ggplot(fu_bolus, aes(lieu, colour = phacdo)) + scale_x_continuous(name = "Relative dose (%)", breaks = seq(60,140,10)) + scale_y_continuous(name = "", breaks = seq(0,1,0.2)) + stat_ecdf() + theme(legend.position="top") + theme(legend.position="top") + geom_vline(xintercept=c(85,90,110,115), linetype="dashed", color = "purple", size=1.2) + ggtitle("5-FU bolus")
p2
#So sánh DRP về liều của tổng liều 5-FU bolus
#Phiên giải giá trị: Pearson's Chi-squared test (cont. adj)
Desc(drp ~ phacdo, data = fu_bolus)
## ------------------------------------------------------------------------------
## drp ~ phacdo
##
##
## Summary:
## n: 1'071, rows: 2, columns: 2
##
## Pearson's Chi-squared test (cont. adj):
## X-squared = 2.9245, df = 1, p-value = 0.08724
## Fisher's exact test p-value = 0.07805
## McNemar's chi-squared = 213, df = 1, p-value < 0.00000000000000022
##
## estimate lwr.ci upr.ci'
##
## odds ratio 0.771 0.578 1.026
## rel. risk (col1) 0.942 0.881 1.007
## rel. risk (col2) 1.223 0.980 1.524
##
##
## Phi-Coefficient 0.055
## Contingency Coeff. 0.054
## Cramer's V 0.055
##
##
## phacdo FOLFOX4 mFOLFOX6 Sum
## drp
##
## Co freq 352 119 471
## perc 32.9% 11.1% 44.0%
## p.row 74.7% 25.3% .
## p.col 42.5% 49.0% .
##
## Khong freq 476 124 600
## perc 44.4% 11.6% 56.0%
## p.row 79.3% 20.7% .
## p.col 57.5% 51.0% .
##
## Sum freq 828 243 1'071
## perc 77.3% 22.7% 100.0%
## p.row . . .
## p.col . . .
##
##
## ----------
## ' 95% conf. level
#Thống kê DPR về liều của 5-FU bolus
Desc(drp_lieu ~ phacdo, data = fu_bolus)
## ------------------------------------------------------------------------------
## drp_lieu ~ phacdo
##
##
## Summary:
## n: 1'071, rows: 3, columns: 2
##
## Pearson's Chi-squared test:
## X-squared = 6.3721, df = 2, p-value = 0.04133
## Likelihood Ratio:
## X-squared = 5.9251, df = 2, p-value = 0.05169
## Mantel-Haenszel Chi-squared:
## X-squared = 3.5675, df = 1, p-value = 0.05892
##
## Warning message:
## Exp. counts < 5: Chi-squared approx. may be incorrect!!
##
##
## Phi-Coefficient 0.077
## Contingency Coeff. 0.077
## Cramer's V 0.077
##
##
## phacdo FOLFOX4 mFOLFOX6 Sum
## drp_lieu
##
## DRP - Cao freq 0 1 1
## perc 0.0% 0.1% 0.1%
## p.row 0.0% 100.0% .
## p.col 0.0% 0.4% .
##
## DRP - Thap freq 352 118 470
## perc 32.9% 11.0% 43.9%
## p.row 74.9% 25.1% .
## p.col 42.5% 48.6% .
##
## Khong freq 476 124 600
## perc 44.4% 11.6% 56.0%
## p.row 79.3% 20.7% .
## p.col 57.5% 51.0% .
##
## Sum freq 828 243 1'071
## perc 77.3% 22.7% 100.0%
## p.row . . .
## p.col . . .
##
Thống kê cho 5-FU iv
#Biểu đồ tích lũy 5-FU iv
p3 = ggplot(fu_iv, aes(lieu, colour = phacdo)) + scale_x_continuous(name = "Relative dose (%)", breaks = seq(60,140,10)) + scale_y_continuous(name = "", breaks = seq(0,1,0.2)) + stat_ecdf() + theme(legend.position="top") + theme(legend.position="top") + geom_vline(xintercept=c(85,90,110,115), linetype="dashed", color = "purple", size=1.2) + ggtitle("5-FU iv")
p3
#So sánh DRP về liều của tổng liều 5-FU iv
#Phiên giải giá trị: Pearson's Chi-squared test (cont. adj)
Desc(drp ~ phacdo, data = fu_iv)
## ------------------------------------------------------------------------------
## drp ~ phacdo
##
##
## Summary:
## n: 1'071, rows: 2, columns: 2
##
## Pearson's Chi-squared test (cont. adj):
## X-squared = 440.62, df = 1, p-value < 0.00000000000000022
## Fisher's exact test p-value < 0.00000000000000022
## McNemar's chi-squared = 416.45, df = 1, p-value < 0.00000000000000022
##
## estimate lwr.ci upr.ci'
##
## odds ratio 0.0287 0.0191 0.0432
## rel. risk (col1) 0.2327 0.1777 0.3047
## rel. risk (col2) 8.0952 6.5342 10.0290
##
##
## Phi-Coefficient 0.644
## Contingency Coeff. 0.542
## Cramer's V 0.644
##
##
## phacdo FOLFOX4 mFOLFOX6 Sum
## drp
##
## Co freq 42 158 200
## perc 3.9% 14.8% 18.7%
## p.row 21.0% 79.0% .
## p.col 5.1% 65.0% .
##
## Khong freq 786 85 871
## perc 73.4% 7.9% 81.3%
## p.row 90.2% 9.8% .
## p.col 94.9% 35.0% .
##
## Sum freq 828 243 1'071
## perc 77.3% 22.7% 100.0%
## p.row . . .
## p.col . . .
##
##
## ----------
## ' 95% conf. level
#Thống kê DPR về liều của 5-FU iv
Desc(drp_lieu ~ phacdo, data = fu_iv)
## ------------------------------------------------------------------------------
## drp_lieu ~ phacdo
##
##
## Summary:
## n: 1'071, rows: 3, columns: 2
##
## Pearson's Chi-squared test:
## X-squared = 454.49, df = 2, p-value < 0.00000000000000022
## Likelihood Ratio:
## X-squared = 401.65, df = 2, p-value < 0.00000000000000022
## Mantel-Haenszel Chi-squared:
## X-squared = 437.67, df = 1, p-value < 0.00000000000000022
##
## Phi-Coefficient 0.651
## Contingency Coeff. 0.546
## Cramer's V 0.651
##
##
## phacdo FOLFOX4 mFOLFOX6 Sum
## drp_lieu
##
## DRP - Cao freq 0 33 33
## perc 0.0% 3.1% 3.1%
## p.row 0.0% 100.0% .
## p.col 0.0% 13.6% .
##
## DRP - Thap freq 42 125 167
## perc 3.9% 11.7% 15.6%
## p.row 25.1% 74.9% .
## p.col 5.1% 51.4% .
##
## Khong freq 786 85 871
## perc 73.4% 7.9% 81.3%
## p.row 90.2% 9.8% .
## p.col 94.9% 35.0% .
##
## Sum freq 828 243 1'071
## perc 77.3% 22.7% 100.0%
## p.row . . .
## p.col . . .
##
Thống kê cho 5-FU tổng
#Biểu đồ tích lũy 5-FU tổng
p = ggplot(fu, aes(lieu, colour = phacdo)) + scale_x_continuous(name = "Relative dose (%)", breaks = seq(60,140,10)) + scale_y_continuous(name = "", breaks = seq(0,1,0.2)) + stat_ecdf() + theme(legend.position="top") + theme(legend.position="top") + geom_vline(xintercept=c(85,90,110,115), linetype="dashed", color = "purple", size=1.2) + ggtitle("5-FU tong")
p
#So sánh DRP về liều của tổng liều 5-FU tổng
#Phiên giải giá trị: Pearson's Chi-squared test (cont. adj)
Desc(drp ~ phacdo, data = fu)
## ------------------------------------------------------------------------------
## drp ~ phacdo
##
##
## Summary:
## n: 1'071, rows: 2, columns: 2
##
## Pearson's Chi-squared test (cont. adj):
## X-squared = 244.1, df = 1, p-value < 0.00000000000000022
## Fisher's exact test p-value < 0.00000000000000022
## McNemar's chi-squared = 366.93, df = 1, p-value < 0.00000000000000022
##
## estimate lwr.ci upr.ci'
##
## odds ratio 0.0917 0.0661 0.1274
## rel. risk (col1) 0.4731 0.4094 0.5466
## rel. risk (col2) 5.1576 4.1421 6.4221
##
##
## Phi-Coefficient 0.480
## Contingency Coeff. 0.433
## Cramer's V 0.480
##
##
## phacdo FOLFOX4 mFOLFOX6 Sum
## drp
##
## Co freq 110 152 262
## perc 10.3% 14.2% 24.5%
## p.row 42.0% 58.0% .
## p.col 13.3% 62.6% .
##
## Khong freq 718 91 809
## perc 67.0% 8.5% 75.5%
## p.row 88.8% 11.2% .
## p.col 86.7% 37.4% .
##
## Sum freq 828 243 1'071
## perc 77.3% 22.7% 100.0%
## p.row . . .
## p.col . . .
##
##
## ----------
## ' 95% conf. level
#Thống kê DPR về liều của 5-FU tổng
Desc(drp_lieu ~ phacdo, data = fu)
## ------------------------------------------------------------------------------
## drp_lieu ~ phacdo
##
##
## Summary:
## n: 1'071, rows: 3, columns: 2
##
## Pearson's Chi-squared test:
## X-squared = 279.53, df = 2, p-value < 0.00000000000000022
## Likelihood Ratio:
## X-squared = 255.73, df = 2, p-value < 0.00000000000000022
## Mantel-Haenszel Chi-squared:
## X-squared = 278.92, df = 1, p-value < 0.00000000000000022
##
## Phi-Coefficient 0.511
## Contingency Coeff. 0.455
## Cramer's V 0.511
##
##
## phacdo FOLFOX4 mFOLFOX6 Sum
## drp_lieu
##
## DRP - Cao freq 0 29 29
## perc 0.0% 2.7% 2.7%
## p.row 0.0% 100.0% .
## p.col 0.0% 11.9% .
##
## DRP - Thap freq 110 123 233
## perc 10.3% 11.5% 21.8%
## p.row 47.2% 52.8% .
## p.col 13.3% 50.6% .
##
## Khong freq 718 91 809
## perc 67.0% 8.5% 75.5%
## p.row 88.8% 11.2% .
## p.col 86.7% 37.4% .
##
## Sum freq 828 243 1'071
## perc 77.3% 22.7% 100.0%
## p.row . . .
## p.col . . .
##
Thống kê cho Leucovorin
#Biểu đồ tích lũy Leucovorin
p4 = ggplot(leuco, aes(lieu, colour = phacdo)) + scale_x_continuous(name = "Relative dose (%)", breaks = seq(60,140,10)) + scale_y_continuous(name = "", breaks = seq(0,1,0.2)) + stat_ecdf() + theme(legend.position="top") + theme(legend.position="top") + geom_vline(xintercept=c(85,90,110,115), linetype="dashed", color = "purple", size=1.2) + ggtitle("Leucovorin")
p4
#So sánh DRP về liều của tổng liều Leucovorin
#Phiên giải giá trị: Pearson's Chi-squared test (cont. adj)
Desc(drp ~ phacdo, data = leuco)
## ------------------------------------------------------------------------------
## drp ~ phacdo
##
##
## Summary:
## n: 1'071, rows: 2, columns: 2
##
## Pearson's Chi-squared test (cont. adj):
## X-squared = 41.039, df = 1, p-value = 0.0000000001492
## Fisher's exact test p-value = 0.0000000001152
## McNemar's chi-squared = 196.07, df = 1, p-value < 0.00000000000000022
##
## estimate lwr.ci upr.ci'
##
## odds ratio 0.385 0.287 0.516
## rel. risk (col1) 0.802 0.747 0.861
## rel. risk (col2) 2.086 1.660 2.622
##
##
## Phi-Coefficient 0.198
## Contingency Coeff. 0.194
## Cramer's V 0.198
##
##
## phacdo FOLFOX4 mFOLFOX6 Sum
## drp
##
## Co freq 317 150 467
## perc 29.6% 14.0% 43.6%
## p.row 67.9% 32.1% .
## p.col 38.3% 61.7% .
##
## Khong freq 511 93 604
## perc 47.7% 8.7% 56.4%
## p.row 84.6% 15.4% .
## p.col 61.7% 38.3% .
##
## Sum freq 828 243 1'071
## perc 77.3% 22.7% 100.0%
## p.row . . .
## p.col . . .
##
##
## ----------
## ' 95% conf. level
#Thống kê DPR về liều của Leucovorin
Desc(drp_lieu ~ phacdo, data = leuco)
## ------------------------------------------------------------------------------
## drp_lieu ~ phacdo
##
##
## Summary:
## n: 1'071, rows: 2, columns: 2
##
## Pearson's Chi-squared test (cont. adj):
## X-squared = 41.039, df = 1, p-value = 0.0000000001492
## Fisher's exact test p-value = 0.0000000001152
## McNemar's chi-squared = 196.07, df = 1, p-value < 0.00000000000000022
##
## estimate lwr.ci upr.ci'
##
## odds ratio 0.385 0.287 0.516
## rel. risk (col1) 0.802 0.747 0.861
## rel. risk (col2) 2.086 1.660 2.622
##
##
## Phi-Coefficient 0.198
## Contingency Coeff. 0.194
## Cramer's V 0.198
##
##
## phacdo FOLFOX4 mFOLFOX6 Sum
## drp_lieu
##
## DRP - Thap freq 317 150 467
## perc 29.6% 14.0% 43.6%
## p.row 67.9% 32.1% .
## p.col 38.3% 61.7% .
##
## Khong freq 511 93 604
## perc 47.7% 8.7% 56.4%
## p.row 84.6% 15.4% .
## p.col 61.7% 38.3% .
##
## Sum freq 828 243 1'071
## perc 77.3% 22.7% 100.0%
## p.row . . .
## p.col . . .
##
##
## ----------
## ' 95% conf. level
Thống kê cho Oxaliplatin
#Biểu đồ tích lũy Oxaliplatin
p5 = ggplot(oxa, aes(lieu, colour = phacdo)) + scale_x_continuous(name = "Relative dose (%)", breaks = seq(60,140,10)) + scale_y_continuous(name = "", breaks = seq(0,1,0.2)) + stat_ecdf() + theme(legend.position="top") + theme(legend.position="top") + geom_vline(xintercept=c(85,90,110,115), linetype="dashed", color = "purple", size=1.2) + ggtitle("Oxaliplatin")
p5
#So sánh DRP về liều của tổng liều oxaliplatin
#Phiên giải giá trị: Pearson's Chi-squared test (cont. adj)
Desc(drp ~ phacdo, data = oxa)
## ------------------------------------------------------------------------------
## drp ~ phacdo
##
##
## Summary:
## n: 657, rows: 2, columns: 2
##
## Pearson's Chi-squared test (cont. adj):
## X-squared = 19.109, df = 1, p-value = 0.00001234
## Fisher's exact test p-value = 0.00001063
## McNemar's chi-squared = 8.3674, df = 1, p-value = 0.00382
##
## estimate lwr.ci upr.ci'
##
## odds ratio 2.067 1.499 2.852
## rel. risk (col1) 1.315 1.160 1.491
## rel. risk (col2) 0.636 0.520 0.778
##
##
## Phi-Coefficient 0.174
## Contingency Coeff. 0.171
## Cramer's V 0.174
##
##
## phacdo FOLFOX4 mFOLFOX6 Sum
## drp
##
## Co freq 258 108 366
## perc 39.3% 16.4% 55.7%
## p.row 70.5% 29.5% .
## p.col 62.3% 44.4% .
##
## Khong freq 156 135 291
## perc 23.7% 20.5% 44.3%
## p.row 53.6% 46.4% .
## p.col 37.7% 55.6% .
##
## Sum freq 414 243 657
## perc 63.0% 37.0% 100.0%
## p.row . . .
## p.col . . .
##
##
## ----------
## ' 95% conf. level
#Thống kê DPR về liều của oxaliplatin
Desc(drp_lieu ~ phacdo, data = oxa)
## ------------------------------------------------------------------------------
## drp_lieu ~ phacdo
##
##
## Summary:
## n: 657, rows: 2, columns: 2
##
## Pearson's Chi-squared test (cont. adj):
## X-squared = 19.109, df = 1, p-value = 0.00001234
## Fisher's exact test p-value = 0.00001063
## McNemar's chi-squared = 8.3674, df = 1, p-value = 0.00382
##
## estimate lwr.ci upr.ci'
##
## odds ratio 2.067 1.499 2.852
## rel. risk (col1) 1.315 1.160 1.491
## rel. risk (col2) 0.636 0.520 0.778
##
##
## Phi-Coefficient 0.174
## Contingency Coeff. 0.171
## Cramer's V 0.174
##
##
## phacdo FOLFOX4 mFOLFOX6 Sum
## drp_lieu
##
## DRP - Thap freq 258 108 366
## perc 39.3% 16.4% 55.7%
## p.row 70.5% 29.5% .
## p.col 62.3% 44.4% .
##
## Khong freq 156 135 291
## perc 23.7% 20.5% 44.3%
## p.row 53.6% 46.4% .
## p.col 37.7% 55.6% .
##
## Sum freq 414 243 657
## perc 63.0% 37.0% 100.0%
## p.row . . .
## p.col . . .
##
##
## ----------
## ' 95% conf. level
grid.arrange(p2, p3, p4,p5 + rremove("x.text"), ncol = 2, nrow = 2)