Created
February 11, 2015 00:24
-
-
Save daynebatten/0b77da1fda605475d329 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run basic setup again | |
library(survival) | |
net_lixx <- read.csv('C:/Users/dayne/Desktop/NetLixx.csv') | |
net_lixx$survival <- Surv(net_lixx$time, net_lixx$churned == 1) | |
# Fit survival curves based on the female binary | |
fit <- survfit(survival ~ female, data = net_lixx) | |
# Plot the results, add a legend, add a title | |
plot(fit, lty = 1:2, mark.time = FALSE, ylim=c(.75,1), xlab = 'Days since Subscribing', ylab = 'Percent Surviving') | |
legend(20, .8, c('Male', 'Female'), lty=1:2, bty = 'n', ncol = 2) | |
title(main = "NetLixx Survival Curves by Gender") | |
# And run a log-rank test | |
survdiff(survival ~ female, data = net_lixx) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment