利用ggDCA包实现COX回归模型临床决策曲线的实战指南

R语言ggDCA包实战:5分钟搞定COX回归临床决策曲线(附乳腺癌数据案例) 本文详细介绍了如何使用R语言的ggDCA包进行COX回归临床决策曲线分析,通过乳腺癌数据案例演示了从数据预处理、模型构建到决策曲线绘制的全流程。ggDCA包支持COX回归模型的多时间点分析,基于ggplot2系统提供美观且可定制的图形输出,帮助研究者评估预测模型在不同决策阈值下的临床净获益,是临床医学研究中模型评估的强大工具。 阅读详情

1. 为什么需要临床决策曲线分析

在临床研究中,我们经常需要评估不同预测模型的实用价值。传统的评价指标如AUC、准确率等虽然能反映模型的预测能力,但它们无法直接回答一个关键问题:使用这个模型指导临床决策,到底能给患者带来多少实际收益?

举个例子,假设我们开发了一个预测乳腺癌患者生存率的模型。医生面临的实际问题是:根据模型预测结果,哪些患者需要接受化疗?如果模型预测某患者5年生存率低于50%,就建议化疗。但这个阈值设定为50%是否合理?化疗本身有副作用,对生存率高于50%的患者可能是弊大于利。这时候就需要临床决策曲线(DCA)来评估不同阈值下的净收益。

2. ggDCA包的优势与安装

2.1 为什么选择ggDCA

在R语言生态中,有几个可以做决策曲线分析的包,但大多数都有明显局限:

  • rmda包:只能处理logistic回归模型
  • stdca脚本:难以获取且使用复杂
  • dcurves包:功能强大但学习曲线陡峭

ggDCA包由南方医科大学Y叔开发,具有独特优势:

  1. 同时支持COX回归和logistic回归
  2. 输出结果可直接用ggplot2美化
  3. 代码简洁直观,学习成本低
  4. 持续更新维护

2.2 安装与加载

安装ggDCA非常简单,可以直接从CRAN安装:

install.packages("ggDCA")

如果需要最新开发版,可以从GitHub安装:

remotes::install_github('yikeshu0611/ggDCA')

使用时需要加载以下包:

library(ggDCA)
library(rms)  # 用于构建COX模型
library(ggplot2)
7. 预测模型评价——DCA曲线 ROC曲线分析,主要是评价模型的准确性,但无论如何选择,都会存在假阳性和/或假阴性的问题。如果疾病危害较小,尚无法治愈,则可以适当增加假阴性,避免假阳性;若疾病的危害大且晚发现预后差,则可以适当增加假阳性,避免假阴性。横坐标为阈概率(threshold probability),纵坐标为净获益( net benefit,NB)。DCA曲线中存在两种极端情况的曲线:1.横的曲线表示所有样本都是阴性,所有人都没有干预,净获益率为0. 阅读详情

相关推荐

R语言ggplot2可视化堆叠条形图(stacked bar plot)、并且在每个条形图的顶端使用数值标签表示整个条形的加和值(sum value above the stacked bar)

R语言ggplot2可视化堆叠条形图(stacked bar plot)、并且在每个条形图的顶端使用数值标签表示整个条形的加和值(sum value above the stacked bar)

data+scenario+science+insight 2572

stata临床决策曲线包.rar

stata临床决策曲线包,包含有dca包和stdca包

南邮-软件设计实验(C++版)

南邮软件设计 A档 一、分数统计 课题内容:   设计一个分数统计程序。包括学生信息的输入输出以及排序。通过该课题全面熟悉数组、字符串、文件的使用,掌握程序设计的基本方法及友好界面的设计。 课题要求: (1)输入某班级学生的姓名、分数; (2)对(1)的分数进行降幂排列并输出; (3)具有输入输出界面。 示例代码: #include<bits/stdc++.h> using...

Dainelcw 1万+

手把手教你理解特斯拉Model 3的域控制器架构:RBCM如何成为“多面手”?

本文深入解析特斯拉Model 3的域控制器架构,重点介绍右车身域控制器(RBCM)如何整合车身电子系统功能。RBCM作为多任务处理中枢,管理空调系统、尾部电气设备和超声波雷达等关键功能,展现了特斯拉在汽车电子架构上的创新设计。文章详细探讨了RBCM的硬件架构、功能版图及信号网络,揭示其如何通过高性能MCU和智能开关技术实现功能集中与效率提升。

weixin_30919429的博客 386

解题报告-美团点评2017秋招笔试编程题--常见动态规划问题

晚上就要美团笔试了,在牛客上刷套美团的题练练手,四道题目全都是典型题目,经典的连题面都懒得改那种,也都不难,很基础的动态规划问题。[编程题] 大富翁游戏时间限制:1秒空间限制:32768K大富翁游戏,玩家根据骰子的点数决定走的步数,即骰子点数为1时可以走一步,点数为2时可以走两步,点数为n时可以走n步。求玩家走到第n步(n&lt;=骰子最大点数且是方法的唯一入参)时,总共有多少种投骰子的方法。 输...

聂小白的专栏 1721

Unity采样器过多导致URP默认的Lit.Shader报错(shader error in ‘universal render pipeline/lit’: maximum ps_4_0 samp)

Shader中多个Sample Texture2D,Sample Texture3D或者类似节点的使用,该类节点都需要一个采样器,如果Shader使用超过了16个纹理采样器,如多个Base Color,Normal Map等,就容易超出。是因为每种Shader Model和GPU都有一个对纹理采样器数量的限制,是因为每个采样器都需要在显卡占用一个独立的寄存器,而寄存器的数量是有限的,当超过限制,显卡无法分配更多的寄存器给新的采样器,因此会导致编译错误。2.什么原因导致纹理采样器超出16个?

qq_41884036的博客 4237

Oracle迁移至华为GaussDB SQL语法和存储过程转换

在将Oracle数据库迁移至GaussDB时,SQL语法和存储过程的转换是确保应用程序正常运行和数据完整性的关键环节。由于两者在数据类型、函数、过程语言等方面存在差异,必须系统化地进行转换和测试。正则表达式脚本:批量替换常见的语法差异。SQL解析工具:解析SQL脚本,生成GaussDB兼容的语法。代码审查工具:自动检查转换后的代码,确保语法和逻辑正确。将Oracle迁移至GaussDB涉及到SQL语法和存储过程的全面转换。通过系统化的转换步骤、使用合适的工具并结合手动调整,可以确保迁移过程的顺利进行。

weixin_38428874的博客 2403

Allegro网表导入报错VOIDs not allowed in parent SHAPE的解决方案

在PCB设计流程中,网表导入是确保电气连接正确传递的关键步骤。其原理是将原理图的逻辑连接关系映射到物理版图的图形数据库中。这一过程的技术价值在于保证设计数据的一致性,避免后续生产中出现电气错误。然而,在Cadence Allegro等EDA工具的实际应用中,数据库内部状态的不一致可能引发操作失败,例如常见的“VOIDs are not allowed in the parent SHAPE”报错。这类问题通常源于多人协作、跨版本操作或频繁编辑后积累的数据结构冗余。针对此场景,核心的解决方法是执行Databa

weixin_30954817的博客 327

TensorRT(C++)部署 Pytorch模型

众所周知,python训练pytorch模型得到.pt模型。但在实际项目应用中,特别是嵌入式端部署时,受限于语言、硬件算力等因素,往往需要优化部署,而tensorRT是最常用的一种方式。本文以yolov5的部署为例,说明模型部署在x86架构上的电脑端的流程。(部署在Arm架构的嵌入式端的流程类似)。

女神sha手的博客 5418

【第24例】华为 IPD 体系 | RMT 需求管理团队

RMT需求管理团队

产品线负责人 1786

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

上一篇: DP读书:鲲鹏920处理器片上系统架构解析与Taishan内核性能优化
下一篇: 从零构建自定义表单系统:数据库设计与前后端协作实践
study
博客等级 码龄27年 68粉丝 1642原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值