R语言:快速完成批量单因素Cox回归分析,并将结果导出为excel
2023年以来浙中医大学郑老师开设了一系列医学科研统计课程,零基础入门医学统计包括R语言、meta分析、临床预测模型、真实世界临床研究、问卷与量表分析、医学统计与SPSS、临床试验数据分析、重复测量资料分析、结构方程模型、孟德尔随机化等10门课,如果您有需求,不妨点击下方跳转查看:
2023年郑老师多门科研统计课程:多次直播,含孟德尔随机化方法

作为生存数据最长用的统计学方法,COX回归出镜率非常高,无论是SCI还是国内期刊,无论是统计专业人员还是普通医学科研工作者,在统计软件普及的今天,实现起来都比较容易。
无论是生存结局影响因素研究,还是近些年非常火爆的临床预测模型(基于生存数据建立的临床预测模型通常称为预后模型),单因素COX回归常用来进行危险因素的筛选,如果指标不多,10个以内,工作量还可以接受。如果指标(变量)达到10个,甚至是几十个,这个工作量就会有些太大了。
掌握一个批量完成单因素COX回归的方法显然是很有必要的。
1、安装ezcox包并调用
"ezcox")
install.packages(library(ezcox)
library(survival) #为了使用自带数据集
2、查看所用数据集
lung
str(lung)
?lung


lung {survival} R Documentation
NCCTG Lung Cancer Data
Description
Survival in patients with advanced lung cancer from the North Central Cancer Treatment Group. Performance scores rate how well the patient can perform usual daily activities.
inst: Institution code
time: Survival time in days
status: censoring status 1=censored, 2=dead
status: censoring status 1=censored, 2=dead
sex: Male=1 Female=2
ph.ecog: ECOG performance score as rated by the physician. 0=asymptomatic, 1= symptomatic but completely ambulatory, 2= in bed <50% of the day, 3= in bed > 50% of the day but not bedbound, 4 = bedbound
ph.karno: Karnofsky performance score (bad=0-good=100) rated by physician
pat.karno: Karnofsky performance score as rated by patient
meal.cal: Calories consumed at meals
wt.loss: Weight loss in last six months
3、分类变量因子化
lung$sex <- factor(lung$sex)
lung$ph.ecog <- factor(lung$ph.ecog)
str(lung)
详情请点击下方:
https://mp.weixin.qq.com/s?__biz=MzAwOTYyMDY3OQ==&mid=2650405305&idx=4&sn=7b1ee7656fc0628b7a80631e4c18b23a&chksm=83518411b4260d075d57ac03f1323996b42f5808339f0739b704b30f7a5a46e18ee8053e7ffb&token=953937483&lang=zh_CN#rd


2023年统计服务