Skip to content

Instantly share code, notes, and snippets.

@daynebatten
Created February 14, 2015 15:13
Show Gist options
  • Save daynebatten/542caa54a18207662d59 to your computer and use it in GitHub Desktop.
Save daynebatten/542caa54a18207662d59 to your computer and use it in GitHub Desktop.
# Load the survival library
library(survival)
# Read in the data and create a "survival object"
netlixx_cox <- read.csv('C:/Users/dayne/Desktop/NetLixxCox.csv')
netlixx_cox$survival <- Surv(netlixx_cox$followtime, netlixx_cox$churn == 1)
# Run a cox regression of survival on female, age, and coupon status
results <- coxph(survival ~ female + age + coupon, data = netlixx_cox)
# View the results!
results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment