Skip to content

Instantly share code, notes, and snippets.

@daynebatten
Last active January 6, 2016 19:40
Show Gist options
  • Save daynebatten/9a8216f69cd9dca0682e to your computer and use it in GitHub Desktop.
Save daynebatten/9a8216f69cd9dca0682e to your computer and use it in GitHub Desktop.
# Load the survival package
library(survival)
# Read in the CSV
data <- read.csv('C:/users/dbatten/google drive/laptop files/personal/time dependent coefficients/tdc_data.csv')
# Fit a cox model of a survival object on the user's gender
fit <- coxph(Surv(time, churn) ~ male, data = data)
# Have a gander at the results
summary(fit)
# Make sure we haven't violated the proportional hazards assumption
cox.zph(fit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment