Using Cox regression I'm trying to find the difference in churnrate for different demographic properties for a dataset with millions of records. The data is similar to below:
user zip time churn 1 422 12 0 2 421 244 0 3 421 13 0 4 411 431 1 . .
I'm doing like this:
library(survival) (load data into data frame df) df$survival <- Surv(df$time, df$churn == 1) results <- coxph(survival ~ zip, data = df)
And getting expected results for each zip-value (ignore the coeffients, it's just dummy data):
> results coef exp(coef) se(coef) z p (zip411 should have been here) zip421 3.70460 40.63375 0.70774 5.23 1.7e-07 zip422 3.71651 41.12044 0.70765 5.25 1.5e-07
However the first zip-code (sorted lowest value) is always missing, no matter what data I input or subset - the first derived group is always gone.
I can solve it by creating a column for each zip-code with a binary value and then specifying each like below. But there must be better ways to do it.
results <- coxph(survival ~ zip411 + zip421 + zip422, data=df)
EDIT: Changed question to better reflect what I'm actually asking. Thanks for clarification.