'When validating cox model: NaN when using rms::validate, Divergence or singularity in [all] samples
I would like to fit a Cox model for prediction of 1-year survival using a specific set of predictors. The data contains 78 events in 620 subjects.
I don't think my problem is related to my data, so here is an example using R data in which I am also unable to use rms::validate().
library(survival)
library(rms)
data(cancer, package="survival")
dd <- datadist(cancer)
options(datadist= 'dd')
# fit
s1yr <- Surv(cancer$time, cancer$status)
cph.euro.log <- cph(s1yr ~ log(age), data = cancer, method = 'exact',
x = TRUE, y = TRUE, surv = TRUE)
# validate
validate(cph.euro.log, B=20)
Divergence or singularity in 20 samples
index.orig | training | test | optimism | index.corrected | n | |
---|---|---|---|---|---|---|
Dxy | 0.1005 | NaN | NaN | NaN | NaN | 0 |
R2 | 0.0179 | NaN | NaN | NaN | NaN | 0 |
Slope | 1.0000 | NaN | NaN | NaN | NaN | 0 |
The output from validate above is similar to what I get for my real data. The function gives point estimates for the predictive performance measures but nothing more (just NaN). What could be the issue?
Solution 1:[1]
Straight from the author's mouth: The function is not yet available for survival models fit using the 'exact' method. If one drops 'exact' and uses, for example, the default method 'efron', it works.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ke.re |