I am working on a survival analysis project. For this project, I use this dataset:
https://archive.ics.uci.edu/dataset/519/heart+failure+clinical+records
I began by importing these libraries :
library(survival)
library("fitdistrplus")
After processing data using factors etc. I performed a Kaplan Meier survival curve estimation using survfit :
Y = Surv(heart_df$time, heart_df$DEATH_EVENT)
fit <- survfit(Y~1,conf.type="plain", type=c("kaplan-meier"))
I would like to know wich statistical density fits the best the estimated survival curve. (fit$surv
).
To do so, I am using fitdist
and use it like this (trying to fit using log-normal density) :
ln <- fitdist(fit$surv,"lnorm")
summary(ln)
plot(ln, demp=TRUE, histo = TRUE)
But in this project I would like to perform tests (Kolmogorov-Smirnov, Cramer-von Mises, Anderson-Darling). So I use goodness of fit like this :
result <- gofstat(ln)
However, when I look at the output cvmtest
and adtest
, it seems these tests were not been computed :
"not computed"
I did the same test with weibull, normal, gamma and beta density. And had also this problem for the normal and beta density. On the top of it, gofstat provides the tests' statistics for example with the AD test applied to lognormal, I have a value of the test statistic :
1.222299
Can anyone provide an explanation of why these tests were not computed when comparing the estimated survival function and some densities ?
Thank you in advance !
fitdistrplus
package.) Please edit the question to provide that information, as comments are easy to overlook and can be deleted. This probably has to do with having censored event times in the survival data, while standard goodness-of-fit tests assume that there are no censored observations. $\endgroup$