June 2017
Beginner to intermediate
576 pages
15h 22m
English
A baseline survival curve by itself is useful, but the most meaningful analysis comes from looking at the different curves that are generated by different segments of groups. That way, you can see where any intervention might be required. To generate this curve for gender, we will again use the survfit() function and specify XGender on the right side of the ~ operator. This code will give us separate survival curves for male and female:
km.gender <- survfit(SurvObj ~ Xgender, data = ChurnStudy, conf.type = "log-log")km.gender plot(km.gender,col=c('red','blue') ,lty=1:2)legend('left', col=c('red','blue') ,c('F', 'M'), lty=1:2)title(main = "Survival Curves by Gender")dev.copy(jpeg,'Ch5 - Survival Plot by Gender.jpg'); ...