O'Reilly logo

Practical Predictive Analytics by Ralph Winters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Contrasting survival curves

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'); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required