# Cox model vs logistic regression

Let's say we are given the following problem:

Predict which clients are most likely to stop buying in our shop in next 3 months.
For each client we know the month when one started to buy in our shop and additionally we have many behavioral features in monthly aggregates. The 'eldest' client has been buying for fifty months; let's denote the time since a client began to buy by $t$ ($t \in [0, 50]$). It can be assumed that the number of clients is very large. If a client stops buying for three months and then comes back, then he is treated as a new customer so an event (stop buying) can occur only once.

Two solutions come into my mind:

Logistic regression - For each client and each month (maybe except the 3 newest months), we can say whether a client stopped buying or not, so we can do rolling samples with one observation per client and month. We can use the number of months since beginning as a categorical variable to obtain some equivalent of base hazard function.

Extended Cox model - This problem can be also modeled using the extended Cox model. It seems that this problem is more suited to survival analysis.

Question: What are the advantages of survival analysis in similar problems? The survival analysis was invented for some reason, so there must be some serious advantage.

My knowledge in survival analysis is not very deep and I think that most potential advantages of the Cox model can also be achieved using logistic regression.

• Equivalent of stratified Cox model can be obtained using an interaction of $t$ and the stratifying variable.
• Interaction Cox model can be obtained by diving the population into several sub-populations and estimating LR for every sub-population.

The only advantage I see is that Cox model is more flexible; for example, we can easily calculate the probability that a client will stop buying in 6 months.

## 3 Answers

The problem with the Cox model is that it predicts nothing. The "intercept" (baseline hazard function) in Cox models is never actually estimated. Logistic regression can be used to predict the risk or probability for some event, in this case: whether or not a subject comes in to buy something on a specific month.

The problem with the assumptions behind ordinary logistic regression is that you treat each person-month observation as independent, regardless of whether it was the same person or the same month in which observations occurred. This can be dangerous because some items are bought in two month intervals, so consecutive person by month observations are negatively correlated. Alternately, a customer can be retained or lost by good or bad experiences leading consecutive person by month observations are positively correlated.

I think a good start to this prediction problem is taking the approach of forecasting where we can use previous information to inform our predictions about the next month's business. A simple start to this problem is adjusting for a lagged effect, or an indicator of whether a subject had arrived in the last month, as a predictor of whether they might arrive this month.

• Couldn't a multilevel logistic regression be used here to solve the issue of independence? Level 2 would be clients and level 1 would be repeated measures over time. – Forinstance Nov 27 '15 at 11:06
• @AdamO, the intercept can be estimated, and combined with the prediction of the individual's partial hazard, we can create individual survival curves. I'm not sure why you think the Cox model can predict "nothing". – Cam.Davidson.Pilon Sep 25 '18 at 15:56
• @Cam.Davidson.Pilon the estimation of the baseline hazard function is an ancillary procedure (Breslow step function) that must be done secondary to the Cox model. Furthermore, there's disagreement on the calculation of uncertainty bounds as the covariance between the cumulative hazard estimate and the model parameters is unclear. The $\delta$-method with assumed independence and the Hall and Wellner bounds are what I use. – AdamO Sep 25 '18 at 16:14
• For prediction purposes, I feel these are not blockers. It's not unusual to combine multiple estimates to create a single prediction, and (unfortunately and I'm not advocating for it) prediction intervals are not commonly used or available anyways. – Cam.Davidson.Pilon Sep 25 '18 at 19:20
• @Cam.Davidson.Pilon I did not say risk predictions cannot be obtained from survival data, I said Cox models do not predict risk. The steps between calling coxph and getting risk estimates are steep and many. – AdamO Sep 25 '18 at 19:29

Let $T_j$ be the time that has elapsed from the time at which client $j$ starts buying until he stops. Survival analysis allows to compute probabilities like $\Pr(T_j > 3)$, i.e. the probability that client $j$ buys for at least $3$ months.

Survival analysis takes into account the fact that each client has his own entry time into the study. The fact that the follow-up period varies across clients is therefore not a problem.

Further, if client $j$ does not stop buying during the study period, then the last follow-up time is recorded and the data is considered right-censored. Survival analysis techniques are specifically designed to propertly handle censoring.

Remark: here is a paper which shows that, under some constraints, both the logistic and the Cox model are linked.

• Thanks for answer. If SA properly handle censoring then it implies that LR solution doesn't handle censoring properly. How coult it result? I still just can't convince myselft that SA is better for a fixed time target. Can I find somewhere this article for free? – Tomek Tarczynski Apr 4 '13 at 10:07
• I guess that you would record $Y = 0$ (no event) for a censored observation. This would underestimate the probability of an event, and might lead to biases. Regarding the paper, I can send it if you leave an email adress. – ocram Apr 4 '13 at 10:32
• My email is: tomek.tarczynski@gmail.com Thank You very much! – Tomek Tarczynski Apr 4 '13 at 11:21
• @TomekTarczynski: received? – ocram Apr 5 '13 at 7:59
• Yes, thanks again! I will have time tomorrow to read it more carefully. I just skimmed it and if I understood correctly it addresses a slight different problem. Using the analogy of shop it compares LR and COX to the problem "What is the probability that client won't be client anymore after fixed number of months from beginning?" – Tomek Tarczynski Apr 5 '13 at 9:02

The marketing literature suggests a Pareto/NBD here or similar. You basically assume the purchase -- while they are purchasing -- follows a negative binomial distribution. But you have to model the time when the customer stops. That's the other part.

Pete Fader and Bruce Hardie have some papers on this, along with Abe.

There are several simpler approaches to the Pareto/NBD, even just counting Fader and Hardie's various papers. Do NOT use the simpler approach in which it is assumed the probability of stopping is constant at each point in time -- that means your heavier customers are more likely to drop out sooner. It's a simpler model to fit, but wrong.

I haven't fit one of these in a while; sorry to be a bit nonspecific.

Here's a reference to the Abe paper, which recasts this problem as a hierarchical Bayes. . If I was working in this area again, I think I would test out this approach.