Created
February 26, 2015 19:12
-
-
Save daynebatten/ef8458a2b02ac8fb5892 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Load the survival library | |
| library(survival) | |
| # Read in the data and create a "survival object" | |
| netlixx_rmst <- read.csv('C:/Users/dayne/Desktop/NetLixxRMST.csv') | |
| netlixx_rmst$survival <- Surv(netlixx_rmst$time, netlixx_rmst$churned == 1) | |
| # Fit a survival curve for each group | |
| fitted <- survfit(survival ~ credit, data = netlixx_rmst) | |
| # Get the 180-day RMST for each group | |
| print(fitted, print.rmean=getOption("survfit.print.rmean"), rmean = 180) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment