0
$\begingroup$

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 !

New contributor
p1char is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
6
  • $\begingroup$ Welcome to Cross Validated! Please edit the question to specify the R package that provides the functions that you called for distribution fitting and goodness of fit. (I suspect that it's the 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$
    – EdM
    Commented Dec 9 at 19:48
  • $\begingroup$ Hello @EdM and thank you for your answer ! I just edited my question, providing the libraries I used. It might be your hypothesis, but in the gofstat documentation, I read this : Computes goodness-of-fit statistics for parametric distributions fitted to a same censored or non-censored data set. (R doc). $\endgroup$
    – p1char
    Commented Dec 9 at 19:53
  • $\begingroup$ @EdM And as I said in the post, when I try to fit other distribution : it worked. So hum ... Idk $\endgroup$
    – p1char
    Commented Dec 9 at 19:58
  • $\begingroup$ I read : For data sets with more than 5 observations and for distributions for which the test is described by Stephens (1986) for maximum likelihood estimations ("exp", "cauchy", "gamma" and "weibull"), the Cramer-von Mises and Anderson-darling tests are performed as described by Stephens (1986) on the documentation maybe AD and CVM weren't performed because the compared distribution isn't exp, cauchyn gamma nor weibull ? Does anyone think it could be this reason ? $\endgroup$
    – p1char
    Commented Dec 9 at 20:04
  • $\begingroup$ @p1char yes, that is exactly the reason -- you can check the source. $\endgroup$
    – PBulls
    Commented Dec 9 at 20:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.