简体   繁体   English

R中的Cox比例风险模型和时间相关的Cox模型

[英]Cox proportional hazard model and time dependent Cox model in R

I have this survival data that describes the mortality rate of three types of services (saloon, restaurant and express)over a ten year time study. 我有这个生存数据 ,描述了十年时间研究中三种类型的服务(轿车,餐厅和快递)的死亡率。

The data contains three variables: service type (1=saloon, 2=restaurant, and 3=express), years (an integer from 1 to 11, where 11 means greater than 10 years) and censor. 数据包含三个变量:服务类型(1 =轿车,2 =餐馆和3 =快捷),年(1到11的整数,其中11表示大于10年)和检查器。

I have two questions: 我有两个问题:

1) I have fitted the Cox proportional hazard model, but what are the ways to check the proportional hazard assumption. 1)我已经拟合了Cox比例风险模型,但是检查比例风险假设的方法是什么。 That is we assume the hazard ratio of each individual and the baseline hazard is independent of time. 也就是说,我们假设每个人的危险比和基线危险与时间无关。

2) How to fit a time dependent Cox model in R? 2)如何在R中拟合时间相关的Cox模型?

Here are my code: 这是我的代码:

   #Cox Proportional Hazards
   cox <- coxph(Surv(Years, Censor) ~ data$`Service Type` )
   summary(cox)

The cox.zph function in pkg survival checks for proportionality. pkg生存率中的cox.zph函数会检查比例。 Do note that using 'Service Type" as a column name provides programming hassles that one can be easily avoid by allowing periods to be substituted for spaces as is the default action with read.table: 请注意,将“服务类型”用作列名提供了编程麻烦,可以通过允许使用句点代替空格来轻松避免编程麻烦,这是read.table的默认操作:

data <- read.table(url("http://www.stat.ufl.edu/~winner/data/bizmort.dat"), col.names=c("Service Type","Years",  "Censor")
# Also note that the censoring indicatior is reversed so will use 1-Censor
require(survival)

cox <- coxph(Surv(Years, 1-Censor) ~ factor(Service.Type), data=data )
# The test fro proportionality:

> cox.zph(cox)
                         rho chisq     p
factor(Service.Type)2 0.0306  0.98 0.322
factor(Service.Type)3 0.0429  1.91 0.167
GLOBAL                    NA  2.33 0.312

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM