June 2017
Beginner to intermediate
576 pages
15h 22m
English
Cox modeling also starts with creating a survival object, as we did in previous examples. Other than that, a cox model looks very similar to a standard regression model with the response variables specified to the left of the ~ and the independent variables specified to the right.
In cox regression modeling, we use the coxph() function over the surv() function to specify the dependent variable. This can be done directly in the formula, or by assigning it to a new variable and specifying the new variable to the left of the ~.
Recall that in defining our original survival object we defined Xtenure2 as the time variable and Churn as the outcome of interest. In our example, we will specify coxph(Surv(Xtenure2, Churn) as the left ...