分享

杂记 | 生存COX分析中的警告

 kesongs 2018-10-12


多因素分析有时候会报警告,例如下面这个:


当然,结果还是能出来的:


其实在R中的警告基本上是可以直接忽略的(注意与报Error是有区别的),但是这多因素分析一下出来两个大段的警告还是有点唬人,我们来看看到底警告了啥~


##### 第一个 Warning

第一个报警告机制如下:


由代码可简单理解,warning是因为出现了infs,A warning message about possible infinite coefficients!


系数coefficients(也就是COX比例风险回归模型中的β values):

When one of the coefficients goes to infinity in a Cox model, the Wald test of significance beta/se(beta) breaks down, and is no longer reliable.


异常大的系数(coxph函数文档中的解释):


http://www1.maths./matstat/bioinformatics/software/R/library/survival/html/coxph.html

https:///questions/19369314/r-coxph-warning-loglik-converged-before-variable

其实,这个警告也可以忽略,因为该因素分析得到的p值基本上接近于1!


再提取其他统计会发现HR的95%置信区间会达到(0, Inf),以性别因素为例:


https://stats./questions/254180/one-covariable-in-multivariate-cox-regression-model-shows-infinite-upper-confide

如下可见,当gender等于1(在小编的数据里是指代FEMALE)的时候,没有event,即没有死亡患者:


所以与coxph函数文档中的解释吻合:

In certain data cases the actual MLE estimate of a coefficient is infinity, e.g., a dichotomous variable where one of the groups has no events.


##### 第二个 Warning

对于第二个警告,看下报警告机制:

结合截图中的结果,可知警告是因为classi_stage系数coef为NA,解释如下:

it is caused by the fact that you have variables which are linear combinations of other variables in your data frame, which make the X matrix non-singular, as the warning suggests.The coxph can deal with this non-singular problem by setting the coefficients of those variables to NA.

perfect classification i.e. one of my variables perfectly predicts the presence of another.

https:///questions/20977401/coxph-x-matrix-deemed-to-be-singular

即变量间具有共线性问题,如下:


针对不同变量,列联表中的值一致,具体到每个变量对应的值:


可以看到,classi_N和classi_stage相对于classi_new具有完全一致的预测/指示意义,例如classi_N/classi_stage为NA的患者,其对应的classi_new值均为2!


共线性的变量该怎么处理?

https://stats./questions/248935/correlated-variables-in-cox-model-which-one-is-best

在coxph函数中有对共线性问题处理的参数,singular.ok,默认为TRUE:

logical value indicating how to handle collinearity in the model matrix. If TRUE, the program will automatically skip over columns of the X matrix that are linear combinations of earlier columns. In this case the coefficients for such columns will be NA, and the variance matrix will contain zeros. For ancillary calculations, such as the linear predictor, the missing coefficients are treated as zeros.


所以最终在结果中的体现就是,第二个出现的存在共线性的变量,其COX结果会置为NA!

小编微信

添加时烦请注明 

姓名-单位-研究方向 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多