如何在R中拟合脆弱的生存模型 [英] How to fit frailty survival models in R

查看:854
本文介绍了如何在R中拟合脆弱的生存模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为这是一个很长的问题,所以我将其分为两部分;第一个只是基本问题,第二个提供了到目前为止我尝试过的细节.

Because this is such a long question I've broken it down into 2 parts; the first being just the basic question and the second providing details of what I've attempted so far.

您如何适应R中的个体脆弱生存模型?特别是,我尝试在下表中重新创建系数估算值和SE,这些系数估算值是通过将半参数脆弱模型拟合到此数据集而找到的

How do you fit an individual frailty survival model in R? In particular I am trying to re-create the coefficient estimates and SE's in the table below that were found from fitting the a semi-parametric frailty model to this dataset link. The model takes the form:

h_i(t) = z_i h_0(t) exp(\beta'X_i)

其中,z_i是每个患者的未知脆弱参数,X_i是解释变量的向量,\beta是相应系数的向量,h_0(t)是使用解释变量疾病,性别 bmi 年龄(我在下面提供了代码以清理因子参考水平).

where z_i is the unknown frailty parameter per each patient, X_i is a vector of explanatory variables, \beta is the corresponding vector of coefficients and h_0(t) is the baseline hazard function using the explanatory variables disease, gender, bmi & age ( I have included code below to clean up the factor reference levels).

我正在尝试遵循并重新创建

I am attempting to follow and re-create the Modelling Survival Data in Medical Research text book example for fitting frailty mdoels. In particular I am focusing on the semi parametric model for which the textbook provides parameter and variance estimates for the normal cox model, lognormal frailty and Gamma frailty which are shown in the above table

我能够使用

library(dplyr)
library(survival)
dat <- read.table(
    "./Survival of patients registered for a lung transplant.dat",
    header = T
) %>% 
    as_data_frame %>% 
    mutate( disease = factor(disease, levels = c(3,1,2,4))) %>% 
    mutate( gender = factor(gender, levels = c(2,1)))

mod_cox <- coxph( Surv(time, status) ~ age + gender + bmi + disease   ,data = dat)
mod_cox

但是,我真的很难找到一个可以可靠地重新创建后2列结果的程序包.在线搜索时,我找到了此表,该表试图总结可用的软件包:

however I am really struggling to find a package that can reliably re-create the results of the second 2 columns. Searching online I found this table which attempts to summarise the available packages:

来源

下面,我发布了我的当前发现以及所使用的包装代码,该代码可以帮助人们确定我是否仅错误地指定了函数:

Below I have posted my current findings as well as the code I've used encase it helps someone identify if I have simply specified the functions incorrectly:

脆弱的EM -似乎最适合伽玛,但不提供对数正态模型

frailtyEM - Seems to work the best for gamma however doesn't offer log-normal models

frailtyEM::emfrail(
    Surv(time, status) ~ age + gender + bmi + disease + cluster(patient), 
    data = dat ,
    distribution = frailtyEM::emfrail_dist(dist = "gamma")
)

生存-在伽玛上发出警告,从我阅读的所有内容来看,似乎它的脆弱功能被归类为已贬值,建议使用coxme代替.

survival - Gives warnings on the gamma and from everything I've read it seems that its frailty functionality is classed as depreciated with the recommendation to use coxme instead.

coxph( 
    Surv(time, status) ~ age + gender + bmi + disease + frailty.gamma(patient), 
    data = dat 
)
coxph( 
    Surv(time, status) ~ age + gender + bmi + disease + frailty.gaussian(patient), 
    data = dat 
)

coxme -似乎可以使用,但提供的估算值与表格中的估算值不同,并且不支持伽玛分布

coxme - Seems to work but provides different estimates to those in the table and doesn't support gamma distribution

coxme::coxme(
    Surv(time, status) ~ age + gender + bmi + disease + (1|patient),
    data = dat
)

franktySurv -我无法正常工作,似乎总是将方差参数拟合为平坦值1,并提供系数估计,就好像没有拟合脆弱模型一样.另外,文档没有说明脆弱的参数支持哪些字符串,因此我无法弄清楚如何使其适合对数常态

frailtySurv - I couldn't get to work properly and seemed to always fit the variance parameter with a flat value of 1 and provide coefficient estimates as if a no frailty model had been fitted. Additionally the documentation doesn't state what strings are support for the frailty argument so I couldn't work out how to get it to fit a log-normal

frailtySurv::fitfrail(
    Surv(time, status) ~ age + gender + bmi + disease + cluster(patient),
    dat = dat,
    frailty = "gamma"
)

脆弱的-产生警告消息,表示未收敛",但仍产生了系数估计,但与教科书有所不同

frailtyHL - Produce warning messages saying "did not converge" however it still produced coeficiant estimates however they were different to that of the text books

mod_n <- frailtyHL::frailtyHL(
    Surv(time, status) ~ age + gender + bmi + disease + (1|patient),
    data = dat,
    RandDist = "Normal"
)
mod_g <- frailtyHL::frailtyHL(
    Surv(time, status) ~ age + gender + bmi + disease + (1|patient),
    data = dat,
    RandDist = "Gamma"
)

脆弱包-我只是不理解实现(或者至少与教科书中所讲的完全不同).该函数需要指定结点和平滑点,这似乎会极大地影响最终的估计.

frailtypack - I simply don't understand the implementation (or at least its very different from what is taught in the text book). The function requires the specification of knots and a smoother which seem to greatly impact the resulting estimates.

parfm -仅适合参数模型;话虽这么说,但每次我尝试使用它来拟合魏布尔比例风险模型时,它都会出错.

parfm - Only fits parametric models; having said that everytime I tried to use it to fit a weibull proportional hazards model it just errored.

phmm -尚未尝试

考虑到我无法成功获得大量的软件包,我非常感激,问题很可能是我自己没有正确理解实现并错过了使用这些软件包的机会.尽管对如何成功地重新创建上述估计值有任何帮助或示例,将不胜感激.

I fully appreciate given the large number of packages that I've gotten through unsuccessfully that it is highly likely that the problem is myself not properly understanding the implementation and miss using the packages. Any help or examples on how to successfully re-create the above estimates though would be greatly appreciated.

推荐答案

关于

我真的很难找到一个可以可靠地重新创建后2列结果的程序包.

I am really struggling to find a package that can reliably re-create the results of the second 2 columns.

请参见下的生存分析CRAN任务视图.随机效应模型,或在例如以下位置的 R网站搜索上进行搜索, "生存薄弱".

See the Survival Analysis CRAN task view under Random Effect Models or do a search on R Site Search on e.g., "survival frailty".

这篇关于如何在R中拟合脆弱的生存模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆