# Modelling likelihood of failure

My goal is to assign vehicles a “risk” score (perhaps on a scale of 1 to 5) based on their history. I have data on the vehicle’s age, model, mileage, and dates it was repaired. This risk score would be used to help prioritize vehicles that should be checked for maintenance.

My proposed approach is to apply a Cox proportional hazards model. I haven’t studied survival analysis methods, but it seems like this model would be able to tell me the likelihood of a vehicle surviving at a given time, so it would yield a value between 0 and 1. I was thinking about binning the output, so if the likelihood of survival is between 0.8 and 1, assign the risk 1.

Questions:

• Is this approach valid? What are some other ways of approaching the problem?
• I’m not really sure how to use the data about the repairaton history (the date(s) the vehicles were repaired). I think it’s a useful variable to include. If a vehicle was repaired recently, then the likelihood of survival should be high.

Your idea is valid, but I can offer an improvement too. Using the Cox model to estimate survival probabilities is do-able, but relies on estimating the baseline survival function, which has a lot of noise. Hence, your final bins will have some noise.

Since your goal is to just to rank vehicles, we can actually skip estimating the baseline survival completely and focus just on the linear predictor (see below). Why is this? Focusing on the form of the Cox model:

$$\underbrace{h(t | x)}_{\text{hazard}} = \overbrace{b_0(t)}^{\text{baseline hazard}} \underbrace{\exp \overbrace{\left(\sum_{i=1}^n b_i x_i\right)}^{\text{linear predictor}}}_ {\text{partial hazard}}$$

Since the baseline hazard (which forms the baseline survival) is the same for everyone, we can ignore this. And if subject A's linear predictor is larger than subject B's, then the survival of A is less than B, for all times. (Note the less than in the previous sentence.)

So you can fit your Cox model, and use just the linear predictors to rank subjects from best to worse. You can apply bins on this output as well.

To use the repair history, the Cox model can be extended to handle time-varying variables. However, prediction in a time-varying setting is difficult, and data-leakage is common (maybe its being repaired because it's on it's last leg) . I would give this a read first.

• Great point about using the linear predictor, but to think about the effect of time since previous repair you need to be much more clear about what is time 0 and what is the event. Do we start when the car is new and stop at first repair? Do we restart at each repair? Simple Cox regression does not directly handle repeated events. – Aniko Aug 14 at 20:25
• @Aniko Good point! I think restarting at each repair makes the most sense. How would I go about doing that? Also, would this still be a concern if I decided to only use how long it took from the second to last repair to the last repair? – bandicoot12 Aug 14 at 20:59
• To be clear, you are measuring time between repairs? So your examples car could be split into two rows with headers (Vehicle, Age, Mileage, was_repaired): (“Car X”, “2 yrs”, “60,000 mi”, True) and (“Car X”, “1 yr”, “30,000”, False) - the latter is False because it hasn't been repaired yet (since it's last repair), hence is censored. – Cam.Davidson.Pilon Aug 18 at 17:37
• Alternatively, are you measuring time to decommissioning vehicles? – Cam.Davidson.Pilon Aug 18 at 17:38
• It sounds like your goal is to measure time between repairs, so a good first approximation is to split a car with multiple repairs into multiple rows, like you did above, and then run a regression on this new dataset, and use the predictions for ranking – Cam.Davidson.Pilon Aug 18 at 17:59