I'm trying to fit parametric survival models for a data that I have, and I don't know how to get the Cox Snell residuals in R.
An example of dataset with Exponential model fitted
install.packages("survival") library(survival) data(lung) fit<-survreg(Surv(time,status)~age+as.factor(sex)+ph.karno,na.action = "na.omit", dist = "exponential",data=lung)
I want to use the Cox Snell residuals to check if the model distribution is good for the data. I will fit a Exponential, Log-Normal, Weibull and Log-logistic model and do these residuals for all them.
So I want to find the Cox Snell residuals and check if these residuals follow a exponential distribution with parameter 1.
A model fits the data well if the Cox-Snell residuals follow an exponential distribution of parameter 1; the Komologorov-Smirnov Goodness of Fit Test (KS-test) is used to assess whether this is the case.
I will do the Komolgorov test later, but I want to check the residuals first.