How to handle negative values in Survival models I am fitting survival models on time-to-event data representing the number of days of delay in paying invoices from the expiration date (negative values represents advance payments). The data consists of some exploratory variables such as the customer, invoice amount, revenue type, expiry month, ecc.
The main goal is to do predictions, but instead of a point estimate I need to compute for new invoices quantities such as the probability of payment in a given month, or the probability of delays greater than x days etc. all of which can be calculated from a survival curve.
Since I also have negative values, referring to payments prior to the due date, in order to be able to use these models I had to make all the values of the outcome greater or equal to 0 removing the minimum observed value (and after estimating the survival curve add it up).
This operation does not completely convince me, because an invoice can be paid before the due date, but not before the issue date, and therefore for each invoice I have a maximum possible number of days in advance of payment (or minimum possible delay value) corresponding to the difference between due date and issue date, information which is not taken into account by the model.
Certainly I can correct the survival curve by dividing the survival probabilities beyond this minimum possible time t by the survival probability evaluated at it (which more generally is the method I use when I want to calculate the survival probabilities conditional on a minimum number of days of delay), but I was wondering if there was a better way to deal with this problem.
I tried to work with the number of days from the date of issue instead of the delay from the due date so as not to have the problem of negative values, and using the number of days between due date and issuing date as a regressor, however the predictive performance are much worse.
Edit: I am using Cox regression (coxph funcion on R) and evaluating performance through concordance in training and test set.
I suspect that the problems in using the date of issue rather than due date (to avoid negative values) is that the time interval between these two dates varies according to the invoice, and most of the invoices are paid close to due date. I added the length of this time interval (due date - date of issue) among the predictors, and of course the estimated coefficient is highly significant (the greater this interval, the further the expected payment is from the date of issue), but maybe the relationship with time from payment to issue is not the one assumed by the Cox model. I think that I need to treat it as a sort of varying intercept rather than a predictor.
 A: Survival analysis can't really work with negative time values, as its starts with 100% survival at time=0. So either you need to define time=0 in some better way or, more likely, you need to adopt a different approach.
My decades-ago experience in accounts receivable suggests that the problem with a single simple Cox model as you have tried so far is that it assumes fundamentally a single type of event process. There isn't. There are fundamentally different types of behaviors that evidently need to be modeled here. Those who are prompt-pay will typically time payments to be received just before the due date. Then there are the others. You need to analyze this in a way that handles those two behaviors separately in a 2-step or maybe a competing-event process.
If you don't care how soon before the due date you receive a payment, you could break the problem down into a two-step combination of a logistic regression model for the probability of an on-time payment and a survival model for the late-payment (event) times. The due date would be considered time=0 for the survival model, with only those who made late payments included so that you don't have to deal with problems of less than 100% survival at that time.
If you do care about how soon before the due date you receive a payment, things are more difficult. You must find some appropriate time=0 setting that represents some day before the earliest day that you could receive payment, and a way to incorporate things like the time between issue date and due date into the model. The question is then how you should model separately the payment times for on-time and late payments.
You could think of this as a special type of competing-event type of analysis, with on-time and late payments as mutually exclusive events after time=0. You could consult the vignette on competing risks from the R survival package for hints, but I think that the presence of a date beyond which on-time payment events can no longer occur poses a problem.
If a payment following an invoice is not made by the due date then there can no longer be an on-time payment event. Although that poses problems for accounts receivable, from the survival perspective your late-pay cases don't ever have that type of on-time payment event and thus are "cured" of that event type after the due date. From the survival analysis perspective, your on-time payment types might need to be modeled by a "cure rate" analysis.
So a combination of a cure-rate analysis for on-time events and some standard survival analysis thereafter might work if you need to model the times of on-time payments. With very little if any censoring of the on-time payment times, you might be able to use some simpler model than a survival model for the on-time payment part of the analysis. I have no experience with implementing these types of combined models, however.
Two further thoughts. First, as you presumably have the same clients involved in multiple instances of billing/payments, the model needs to take that into account somehow, for example with an id variable specification in the survival model. Otherwise the standard errors of your model will not be calculated properly. Second, you might want to consider a parametric model rather than the semi-parametric Cox approach. The Cox model simply uses the data to describe an empirical baseline hazard or survival function. It's not always clear how well that will model new cases, and it is limited by the finite times at which that baseline is allowed to change and the inability to extend predictions even slightly beyond the last observation time. A parametric model with an exponential, Weibull, log-normal, or other defined form might be more useful.
