今天被要求画一下决策曲线,用Python试了半天也没画出来,最后参考了资料还是用R语言绘制了出来。
数据的格式
将四条曲线画在一张表中
library(rmda)
library(readxl)# 读取Excel文件
data <- read_excel("C:/Users/Administrator/Desktop/肺动脉数据1000.xlsx")baseline.model <- decision_curve(y~Qanadli指数 + AD + 血凝块比率+联合,data = data,thresholds = seq(0, .4, by = .01),bootstraps = 10)set.seed(123)# 为每个特征创建决策曲线模型
model_qanadli <- decision_curve(y~Qanadli指数,data = data,thresholds = seq(0, 1, by = .01),bootstraps = 10)model_ad <- decision_curve(y~ AD,data = data,thresholds = seq(0, 1, by = .01),bootstraps = 10)model_coagulation <- decision_curve(y~血凝块比率,data = data,thresholds = seq(0, 1, by = .01),bootstraps = 10)model_combined <- decision_curve(y~联合,data = data,thresholds = seq(0, 1, by = .01),bootstraps = 10)# 绘制四条决策曲线
plot_decision_curve(list(model_qanadli, model_ad, model_coagulation, model_combined),curve.names = c("Qanadli", "AD", "Coagulation", "Combined"),cost.benefit.axis = FALSE,confidence.intervals = FALSE,standardize = FALSE)