I am using Survival Analysis to analyse a data set, but i'm having a bit of trouble.
The data consists of everyone who has/has not been terminated from employment within a 4 year period. The aim of the analysis is to uncover the median time to termination.
The data includes 400 people who has experienced the event and 2275 people who have not.
Looking at the raw data, 150 people have remained employed between 30-48 years. The remaining 2525 people have been employed for less than 30 years. The average time spent working in the organisation is 4 years.
However, the median time to survival using survival analysis is 40 years.
I'm very familiar with the organisation and this median time to leaving is counter intuitive. Am I missing something?
My code is below
You will see, I start by calculating the length of time from when they began working in the organisation and when they leave (variable name is 'yrs'). If they have not been terminated, today's date is used as they are still employed in the organisation (perhaps this is where i'm going wrong?).
Then I create a survival curve using 'yrs' and 'termid', where termid is an indicator variable, indicating if the observation has been terminated or not.
The median survival time of 40 years is then returned
Is there an issue with my code? Or is it expected that so few observations could carry this much weight in a Survival Analysis.
#find survival time #calculating the number of days between last follow up date and date of starting in the organisation leaversanalysis = leaversanalysis %>% mutate( yrs = as.numeric( difftime(Term.Date, Date.Joined.Organisation, units = "days")) / 365.25 ) #Indicator variable for termination is 'termid' #Kaplan Meier estimator for any termination (termination =1, no termination =0) a <- Surv(leaversanalysis$yrs, leaversanalysis$termid) #Create survival curve surv_curvleave <- survfit(Surv(yrs, termid) ~ 1 , data = leaversanalysis) surv_curvleave